-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
Description
What did you do?
I have this file:
(you'll have to unzip it to test, I zipped it so that I could upload it in this issue)
I'm running the following script:
from PIL import Image
img = Image.open("20210415185447038_0158.tiff")
# any of these operations make the final line work
#img = img.convert("L")
#img = img.rotate(180).rotate(180)
# removing the compression argument also makes it work
img.save("test.tiff", compression="tiff_deflate")What did you expect to happen?
I expected the file to be saved
What actually happened?
I got
$ python3 convert_tiff.py
_TIFFVSetField: toto2.tiff: Ignored tag "OldSubfileType" (not supported by libtiff).
Traceback (most recent call last):
File "/home/admin/tmp/convert_tiff.py", line 8, in <module>
img.save("toto2.tiff", compression="tiff_deflate")
File "/home/admin/.local/lib/python3.9/site-packages/PIL/Image.py", line 2439, in save
save_handler(self, fp, filename)
File "/home/admin/.local/lib/python3.9/site-packages/PIL/TiffImagePlugin.py", line 1838, in _save
e = Image._getencoder(im.mode, "libtiff", a, encoderconfig)
File "/home/admin/.local/lib/python3.9/site-packages/PIL/Image.py", line 420, in _getencoder
return encoder(mode, *args + extra)
RuntimeError: Error setting from dictionary
What are your OS, Python and Pillow versions?
- OS: Debian 5.10
- Python: 3.9.2
- Pillow: 10.2.0
The strange thing is that if I do anything with the image then saving works, or if I save it uncompressed it works too, it only fails when I save the untouched image.