Aspect ratios of images: finding out dimensions
Posted: Mon Jul 23, 2007 2:41 pm
How would you scale an image up to fill the available window without distortion. I can see that if you can find out in advance the dimensions of an image, you can find out the larger of the height/width and then calculate a scale factor that scales that up to the container.
If there's no other way to get proportional scaling (and how often do you want non-proportional scaling?) what's a good way to get the dimensions of an image? For my personal MacOS X use, I can use 'sips'. But what's a good x-platform way?
Best from a user's point of view would be a flag saying 'scale to fit, while maintaining aspect ratio', but I suspect that's not easy to implement?
If there's no other way to get proportional scaling (and how often do you want non-proportional scaling?) what's a good way to get the dimensions of an image? For my personal MacOS X use, I can use 'sips'. But what's a good x-platform way?
Best from a user's point of view would be a flag saying 'scale to fit, while maintaining aspect ratio', but I suspect that's not easy to implement?