Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Save to PDF broken -> segmentation fault #215
with the pillow version included in Ubuntu 13.04 (2.0.0) I get a segmentation fault with the following code:
from PIL import Image
After some debuging I think that the bug was introduced with the commit from 13-03-06 to add qtables support to the JPEG encoder. The code there assumes that the parameter qtables in PyImaging_JpegEncoderNew is set. This is not true when calling ImageFile directly (as the PDF plugin does).
My recommend fix would be setting the qtables local variable to NULL and then checking in get_qtables_arrays that the passed parameter is not NULL (in addition to the Py_None check)
With the fix my example works. On the other hand it might be a better idea to pass the JPEG settings to the encoder when saving the image embedded in the PDF. This would require exporting the code in PIL.JpegImagePlugin._save that sets im.encoderconfig. What do you think?