Thank you, Kevin - the image got much better. JPG accepts the "quality" tag 
(ex.: quality=95). Still, as someone pointed out, it seems I should try other 
formats like TIFF or PNG.

Eduardo

CC: image-sig@python.org
From: ke...@cazabon.com
To: ei...@hotmail.com
Subject: Re: [Image-SIG] PIL - problem with crop()
Date: Mon, 27 Apr 2009 06:58:36 -0400

are you setting the resolution when re-saving as a PDF in PIL?  That would 
explain the scaling issue, and likely the quality too.
PIL now supports resolution settings for most common file formats - add a 
dpi=300 tag when saving, for example:
im.save("test.pdf", dpi=300)
Kevin.


On 26 Apr 2009, at 16:53, Eduardo Ismael wrote: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
Quer saber qual produto Windows Live combina melhor com o seu perfil? Clique 
aqui e descubra! _______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig


_________________________________________________________________
Emoticons e Winks super diferentes para o Messenger. Baixe agora, é grátis!
http://specials.br.msn.com/ilovemessenger/pacotes.aspx
_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to