[Image-SIG] JPEG low quality
Laura & Edward Cannon
cannon.el at gmail.com
Tue Sep 15 19:47:22 CEST 2009
On Wed, Sep 2, 2009 at 1:04 PM, Vinicius Mendes <vbmendes at gmail.com> wrote:
> 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
> Image-SIG maillist - Image-SIG at python.org
don't try and save with quality=100, values above 95 are not
recommended. You might also try not using the progressive option and
see if that works better for you. Also re-saving JPEG's always leads
to a loss in quality.
More information about the Image-SIG