[Image-SIG] some trouble about jpeg encode in PIL
feihu_roger
feihu_roger at yahoo.com.cn
Fri Oct 27 12:41:21 CEST 2006
nice, this is OK.
Thanks
> this is a known limitation; PIL uses the JPEG library's incremental encoding mode, but
> that doesn't work right in combination with progressive encoding, when the image is too
> large. to work around this, you can
>
> 1. fallback on non-progressive encoding when you get the above error
>
> try:
> im.save(outfile, quality=90, progressive=1)
> except IOError:
> im.save(outfile, quality=90) # retry in non-progressive mode
>
> and/or
>
> 2. tweak the ImageFile.MAXBLOCK value before you save the image; you can either
> simply set it to something reasonably large (e.g. 256*1024 or even 1024*1024) up front:
>
> import ImageFile
>
> ImageFile.MAXBLOCK = 1024*1024
>
> or bump the size only if you get the above error.
__________________________________________________
¸Ï¿ì×¢²áÑÅ»¢³¬´óÈÝÁ¿Ãâ·ÑÓÊÏä?
http://cn.mail.yahoo.com
More information about the Image-SIG
mailing list