[Image-SIG] Error when saving JPEG with quality above 85 and optimize

Nir Soffer nirs at freeshell.org
Sun Apr 2 17:38:01 CEST 2006


When I try to save JPEG files with quality above 85 and optimize=1, I 
get this traceback:

 >>> image.save("foo.jpg", quality=86, optimize=1)

Suspension not allowed here
Traceback (most recent call last):
   File "<stdin>", line 2, in ?
   File "<stdin>", line 2, in save
   File "/opt/local/lib/python2.4/site-packages/PIL/Image.py", line 
1305, in save
     save_handler(self, fp, filename)
   File "/opt/local/lib/python2.4/site-packages/PIL/JpegImagePlugin.py", 
line 409, in _save
     ImageFile._save(im, fp, [("jpeg", (0,0)+im.size, 0, rawmode)])
   File "/opt/local/lib/python2.4/site-packages/PIL/ImageFile.py", line 
491, in _save
     raise IOError("encoder error %d when writing image file" % s)
IOError: encoder error -2 when writing image file

For publishing photographs in both full size and thumbnails, I find 
quality level of 90-95 to give the best results. I hoped that optimize 
would give even better results :-)

I compared PIL, GIMP and Photoshop output, seems that all give almost 
identical results for the same output file size. PIL seems to give 
little sharper results - maybe because I resized the images using 
ANTIALIAS and both Photoshop and GIMP support only BICUBIC filter?

Last, a note about the docs:

	"Keyword options can be used to provide additional instructions to the 
writer. If a writer
	doesn't recognise an option, it is silently ignored."

Thats evil - if an option is not recognized, it should raise.

	"The available options are described later in this handbook."

Where is the link to the options? at least where is "later"?


Best Regards,

Nir Soffer



More information about the Image-SIG mailing list