I am trying to compress some jpeg images from 24X36 inches to 11X16.5 inches using the python image library. Since PIL deals with pixels, this should mean scaling from 7200X 4800 pixels to 3300 X2200 pixels with a resolution of up to 200 pixels / inch, however, when I run my PIL script, the resolution changes to 72 pixels / inch, and in the end I get more than before.
import Image im = Image.open("image.jpg") if im.size == (7200, 4800): out = im.resize((3300,2200), Image.ANTIALIAS) elif im.size == (4800,7200): out = im.resize((2200,3300), Image.ANTIALIAS) out.show()
Is there a way to change image resolution when resizing images?
Thanks for any help!
source share