Image Rescale - help please...
BlitzMax Forums/BlitzMax Programming/Image Rescale - help please...
| ||
okay, so I'm trying to set up a system where the program reads and loads images from a directory and then draws them to an editor palette. my current obstacle is trying to get the software to scale the images down to a certain size. I need to scale the image down to 32x32 regardless of its original dimensions but because the Blitz Max scale system works in such a way I'm having a hard time formulating a code that would fit my needs. I dont understand why I cant just easily set the x and y scale and be done with it. can somebody help me out here? |
| ||
Hmm, I thought you'd be able to use some basic calculus with that, no? Use the size you want divided by the image original size to give you a scale factor to use. 32/64 = 0.5, so scale the original image by 0.5 32/128 = 0.25 You obviously need to deal x and y separately. Something tells me that there's more to your problem than that though ;-) |
| ||
Yeah, I've used that basic logic and other things, but no matter what I cant get it down to what I want. :P |
| ||
You need to have one side (at least) of the equation as a float, in order to return a float as the result. Otherwise you'll get 0 every time. |
| ||
I've got all the related values as floats already :P |
| ||
here's what I've got so far... Last edited 2012 |
| ||
SetScale rescale_y,rescale_x <- This is backwards you're setting y scale for x and x scale for y... Do you really want 32x32, or do you want to preserve the image's aspect ratio with a 32x32 maximum? If you want to preserve the aspect ratio you need to get the scale values and then just use the smallest one for both x and y scale. |
| ||
oh hey, wow! I did not see that mistake! and fixing it causes everything to work as desired! thank you! thank you! thank you! :D!!!!! |
| ||
Lol |
| ||
the funny thing is... I dont even know HOW I got that backwards! :O |