bigmac bigmac - 5 months ago 11
Python Question

How to adjust the quality of a resized image in Python Imaging Library?

thanks for taking time to read my question.

I am working on PIL and need to know if the image quality can be adjusted while resizing or thumbnailing an image. From what I have known is the default quality is set to 85. Can this parameter be tweaked during resizing?

I am currently using the following code:

image =
image.thumbnail((x, y), img.ANTIALIAS)

parameter presumably gives the best quality. I need to know if we can get more granularity on the quality option.


Use PIL's resize method manually:

image = image.resize((x, y), Image.ANTIALIAS)

Followed by the save method

quality_val = 90, 'JPEG', quality=quality_val)

Take a look at the source for from Photologue to see how they do it.