ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> image-sig
image-sig
[Image-SIG] Error when saving JPEG with quality above 85 and optimize
by Nir Soffer other posts by this author
Apr 2 2006 8:56AM messages near this date
Re: [Image-SIG] PhotoImage Class | Re: [Image-SIG] Error when saving JPEG with quality above 85 and optimize
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

_______________________________________________
Image-SIG maillist  -  Image-SIG@[...].org
http://mail.python.org/mailman/listinfo/image-sig
Thread:
Nir Soffer
Jim Tittsler

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved