[Image-SIG] PIL resize with aspect ratio?

Count László de Almásy calmasy at gmail.com
Thu Jan 5 20:49:17 CET 2006


Greetings,

I'm new to PIL, and am wondering if the following is possible.

I want to resize an image by only specifying the width, but not the
height.  The height should be expanded or contracted automatically to
fit the width value while maintaining the aspect ratio of the image.

Second, I want to be able to specify the JPEG compression level.

If you are familiar with ImageMagick, these would be accomplished
using the following for example:

% mogrify -quality 95 -resize 500x big.jpg

I can't figure out whether these things are possible from the PIL
documentation or not.  Any ideas?

Thanks.


More information about the Image-SIG mailing list