[Image-SIG] JPEG low quality

Vinicius Mendes vbmendes at gmail.com
Wed Sep 2 22:04:19 CEST 2009


Hi,

I've created a script using PIL that opens a JPEG image and saves it with
another name. What happens is that the saved image's quality is gets very
low, even if I set quality=100. Somebody already experienced such a problem?
Knows how to achieve a better quality? Saving the image as PNG the quality
is perfect, but the filesize gets huge.

The code I used was:

from PIL import Image
imagem = Image.open("original_file.jpg")
imagem.save("file_saved_by_pil.jpg", "JPEG", quality=100, progressive=True)

The original image file is: http://twitpic.com/g86ug
And this is the one generated by PIL: http://twitpic.com/g8735

Pay attention that the original file has the text "conheça" legible and with
a good filesize. The one generated by PIL has almost the same filesize but
the text is illegible.

My script will do more sutff then just open and save the image with another
name: it will open two images, put one above the other and write some text
on it. This was already achieved. The problem is just the quality.

Thanks for the patience.
---
Vinícius Mendes
Computer Engineer
http://meiocodigo.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20090902/0e6a210b/attachment.htm>


More information about the Image-SIG mailing list