[Image-SIG] PIL image size after rotate

Chad Ferguson terrafergus at gmail.com
Sun Nov 11 05:01:45 CET 2012


Listers,

I have a very simple script that rotates images using PIL.  After 
running, the output images are about 1/3 the file size of the input 
image.  The file attributes indicate they have increased in resolution 
from 72 to 96 ppi but have the same radiometric depth. Does the PIL 
rotate method apply a hidden resampling? Why are the output images so 
much smaller?

from PIL import Image
import glob, os

indir = r'C:\Users\Me\Pictures\export'
for infile in glob.glob(indir + '\\' + "*.jpg"):
     print infile
     file, ext = os.path.splitext(infile)
     im = Image.open(infile)
     im2 = im.rotate(270)
     im2.save(file +"_rotate.jpg", "JPEG")
    #  os.remove(infile)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: terrafergus.vcf
Type: text/x-vcard
Size: 51 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20121111/4cadfcef/attachment.vcf>


More information about the Image-SIG mailing list