Author Topic: Image Cropping/Moving program  (Read 5219 times)

0 Members and 1 Guest are viewing this topic.

Offline Eniripsa96

  • LV2 Member (Next: 40)
  • **
  • Posts: 28
  • Rating: +3/-0
    • View Profile
Image Cropping/Moving program
« on: February 04, 2010, 04:42:14 pm »
Well, the formula method cannot work, because i found one that actually worked to an extent, created an image that resembles it but it wasnt perfect, or close to perfect so I will just have to start from scratch again and hope to find a new method
« Last Edit: February 05, 2010, 02:40:43 pm by Eniripsa96 »

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Image Cropping/Moving program
« Reply #1 on: February 04, 2010, 04:49:21 pm »
Sounds cool.  You'll have to put a cap on it somewhere, as huge lists of matricies take up a ton of RAM.  I'd use a matrix, with a max-cap of 50*50 (22511 bytes).  Good luck!
« Last Edit: February 04, 2010, 04:49:34 pm by ztrumpet »

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Image Cropping/Moving program
« Reply #2 on: February 04, 2010, 05:11:31 pm »
Yeah, your going to need to find some sort of compression technique, as a list can only hold 999 elements, and there are 5795 pixels on the screen.

If you wanted to use an assembly lib, I'm sure xLib would be very helpful for this program, with its handy sprite manipulation, although i can understand if you want to code it yourself :)
« Last Edit: February 04, 2010, 07:26:47 pm by Builderboy »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Image Cropping/Moving program
« Reply #3 on: February 04, 2010, 07:00:04 pm »
Builderboy, you mean 999 elements, right?
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Image Cropping/Moving program
« Reply #4 on: February 04, 2010, 07:00:44 pm »
I think he does.  Builderboy, are you in a hurry?

Offline Eniripsa96

  • LV2 Member (Next: 40)
  • **
  • Posts: 28
  • Rating: +3/-0
    • View Profile
Re: Image Cropping/Moving program
« Reply #5 on: February 04, 2010, 07:12:00 pm »
I tried doing that but fitting an entire picture doesnt work, ive resorted to making a list of each spot that is shaded in, giving a value for each pixel, like the top right pixel (0,62) would be 1 and such, however i think ill have to make some formulas for making the movements of the picture much more complicated though >_>

At least it will give me something to do during math class lol

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Image Cropping/Moving program
« Reply #6 on: February 04, 2010, 07:28:01 pm »
I think he does.  Builderboy, are you in a hurry?

Haha, no i was using my iTouch in class. :P

 * fixes all my horrible mistakes *
* Goes off in search of more iTouch posts *

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Image Cropping/Moving program
« Reply #7 on: February 04, 2010, 07:34:31 pm »
I made something like this a while ago, but it did a bit more than moving/cropping. I choose to use a Matrix as my preferred storage method.  The problem is as the other said though, size. I'll be interested in see what solution you come up with. =)

Offline Eniripsa96

  • LV2 Member (Next: 40)
  • **
  • Posts: 28
  • Rating: +3/-0
    • View Profile
Re: Image Cropping/Moving program
« Reply #8 on: February 04, 2010, 10:11:54 pm »
haha! i think i came up with a way that takes very little memory to store the picture. I'm going to store a row as a large number, in 1s and 0s like binary, 1s being the pixel is shaded, 0 being it not. Extracting could be like setting A to the X value you want to get, then doing iPart(L2(y)^(x-1 to get it to the x digit and beyond, then iPart(L2(y)^x)/10 to get the spot right above it, then subtracting the second one from the first one to get it, this is a possibility and hopefully it works.
Memory-wise, it stores an entire row for a mesley 9 bytes, so the list in whole would be 579 bytes, and thats less than a picture's normal storage value o.O

I hope this works :)

Note: the y is the column # and the L2 is the list
« Last Edit: February 04, 2010, 10:15:31 pm by Eniripsa96 »

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Image Cropping/Moving program
« Reply #9 on: February 04, 2010, 10:19:57 pm »
It would work, but only if numbers were store with huge amounts of precision.  Unfortunatly the best compression like that yields only 12-14 digits (depending on how you do it; I think 14 is impossible to decompress) because of the way variables are stored.  Thus: 63*95=5985 /13=460.385  So to compress a whole picture, it would take 461 list elements and with those at 9 bytes each is 4149 bytes total.  I'm sorry that this dosn't do much for you other than smashing your hopes, but it could still be useful-It's a lot easier to manipulate than a picture variable.  If you decide to move pictures around this way, it's still a great idea.  Good luck! :)
« Last Edit: February 04, 2010, 10:20:43 pm by ztrumpet »

Offline Eniripsa96

  • LV2 Member (Next: 40)
  • **
  • Posts: 28
  • Rating: +3/-0
    • View Profile
Re: Image Cropping/Moving program
« Reply #10 on: February 04, 2010, 10:27:04 pm »
oh, i changed it a little, typed it in, and it did extract the single number :D

instead, its iPart(L2(Y)/10^(x))-iPart(L2(Y)/10^(x-1))/10

maybe this will work after all :)
quite the annoying formula though >_<

EDIT: Fixed Formula ._.

EDIT: dang...found a glitch....back to editing it
« Last Edit: February 04, 2010, 10:43:56 pm by Eniripsa96 »

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Image Cropping/Moving program
« Reply #11 on: February 04, 2010, 10:47:49 pm »
If you where to use xlib/celticIII you could just use the sprite command to do it. But this is interesting. I would suggest hex, but that would be really slow x.x how about converting tw binary lines to integers? Like 0010=2 and 1001=9, kind of like binary, but this would be faster due to the fact that no strings would be involved.
/e

Offline Eniripsa96

  • LV2 Member (Next: 40)
  • **
  • Posts: 28
  • Rating: +3/-0
    • View Profile
Re: Image Cropping/Moving program
« Reply #12 on: February 04, 2010, 11:01:25 pm »
Formula was proven faulty
« Last Edit: February 05, 2010, 02:41:10 pm by Eniripsa96 »

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Image Cropping/Moving program
« Reply #13 on: February 05, 2010, 04:06:44 pm »
so I found a way to compress the data of three pixels down to 1 byte...000=0 100=1 010=2 110=3 001=4 101=5 011=6 111=7
you can then use your method of saving to store that instead of 0=off 1=on
/e

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Image Cropping/Moving program
« Reply #14 on: February 05, 2010, 04:08:14 pm »
That's pretty cool Eeems, but wouldn't it be pretty slow?