Created attachment 551446 [details] emerge --info The following trivial script from PIL import Image IM=Image.open('Testbild.jpeg') IM.save('Testbild_mod.jpeg',optimize=False) fails with I/O suspension not supported in scan optimization Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.7/site-packages/PIL/Image.py", line 1969, in save save_handler(self, fp, filename) File "/usr/lib/python3.7/site-packages/PIL/JpegImagePlugin.py", line 761, in _save ImageFile._save(im, fp, [("jpeg", (0, 0)+im.size, 0, rawmode)], bufsize) File "/usr/lib/python3.7/site-packages/PIL/ImageFile.py", line 519, in _save raise IOError("encoder error %d when writing image file" % s) OSError: encoder error -2 when writing image file Testbild.jpeg has 4807077 bytes. Is there any fix or work around? Thanks, Helmut
I have tried the same script with pillow 5.3 on python 3.6 on a jpeg I had lying around. It saved properly. Two possibilities I see: 1. Is it related to the image? Maybe try with other jpeg files to confirm. 2. python3.7? I'm not geared up to test this now, will try later. Or if you'd like to try with py36 on your end, it would be great. "I/O suspension" looks like a py37-related problem...
(In reply to Virgil Dupras from comment #1) > I have tried the same script with pillow 5.3 on python 3.6 on a jpeg I had > lying around. It saved properly. Two possibilities I see: > > 1. Is it related to the image? Maybe try with other jpeg files to confirm. > 2. python3.7? I'm not geared up to test this now, will try later. Or if > you'd like to try with py36 on your end, it would be great. > > "I/O suspension" looks like a py37-related problem... It's exactly the same situation with Python3.6. I have seen certain error reports on the net which claim that it might be related with the MAXBUFFER size. With an image of 458K it works just fine, with an image of 645K or bigger it shows the error reported here.
I don't know, my test was made with a 1.66M jpeg file and didn't trigger the bug, so reproduction conditions don't seem so easy to gather.
Might it be related to https://github.com/python-pillow/Pillow/issues/539 ?
(In reply to Virgil Dupras from comment #4) > Might it be related to https://github.com/python-pillow/Pillow/issues/539 ? Yes, I've removed media-libs/mozjpeg which solves the problem. Thanks!
media-libs/mozjpeg isn't part of the gentoo tree. How come pillow built against it? Was it your sole installed jpeg library? What overlay did your version of media-libs/mozjpeg come from?
(In reply to Virgil Dupras from comment #6) > media-libs/mozjpeg isn't part of the gentoo tree. How come pillow built > against it? Was it your sole installed jpeg library? What overlay did your > version of media-libs/mozjpeg come from? media-libs/mozjpeg came from my local overlay. I'm not sure that mozjpeg was the culprit. I have media-libs/openjpeg:0 and media-libs/openjpeg:2 as well as media-libs/libjpeg-turbo installed here.