[Image-SIG] PIL - problem with crop()

Eduardo Ismael eismb at hotmail.com
Sun Apr 26 22:53:40 CEST 2009


Hi!

I have a bunch of .jpg images of 2866 x 4047. When I
right-click on them and use the "Convert to Adobe PDF" option from
Acrobat, an Acrobat window opens showing the document with great
quality and zoom of 121% - and if I zoom down to 100%, it looks like
the original quality.

However, I would like to crop the bottom
of all pages before conveting to PDF, so i get back to the original and
use "im.crop((0, 0, 2866, 3760))".

Now, if I use the method
above to convert to PDF, the PDF will open at 21,9% - the image got
much bigger! - and if I zoom up to 100%, it gets awful. I understand
PIl is not only cropping the image, but also affecting its quality.

Any suggestions on how to avoid that?

Here is the complete script:
import os, Image

preCropFolder = "C:\\PDF\\preCropFolder"
postCropFolder = "C:\\PDF\\postCropFolder"


inputImages = os.listdir(preCropFolder)

for file in inputImages:
    eachImage = preCropFolder + "\\" + file
    im = Image.open(eachImage)
    im = im.crop((0, 0, 2866, 3760)) # original is 2866 x 4047
    eachImage = postCropFolder + "\\" + file
_________________________________________________________________
Novo Windows Live: Messenger 2009 e muito mais. Descubra!
http://www.windowslive.com.br
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20090426/b3ee894c/attachment.htm>


More information about the Image-SIG mailing list