I'm trying to use PIL to save some Progressive, Retina-sized images for use on the iPad 3, but keep receiving the "encoder error -2" mentioned in the question title.
I am aware that this is a known PIL + Jpeg issue, and after some reading I heard it could be solved by adding something like this to your code:
import PIL
from PIL import ImageFile
from exceptions import IOError
try:
img.save("img.jpg", "JPEG" , quality=80, progressive=True)
except IOError:
PIL.ImageFile.MAXBLOCK = img.size[0] * img.size[1]
img.save("img.jpg", "JPEG" , quality=80, progressive=True)
However, even after using the above method to increase PIL's Maxblock, my script still throws an "encoder error -2". I also tried making the MAXBLOCK obscenely large, but had no luck with that, either:
PIL.ImageFile.MAXBLOCK = 2048 ** 10
The images I am trying to process are fairly large (2048 x 2048), but I'm hesitant to believe that they are simply too large for PIL to handle.
Has anyone else encountered/resolved this type of issue?