https://stuff.realpath.org/test.bmp is a very simple BMP image (unfortunately GitHub doesn't allow to attach it here).
First exception
When I try to convert it to a TIFF:
with Image.open("test.bmp") as im:
im.save("test.tiff", format="TIFF")
I get the following exception:
Traceback (most recent call last):
File "convert.py", line 4, in <module>
im.save("test.tiff", format="TIFF")
File "venv\lib\site-packages\PIL\Image.py", line 2300, in save
save_handler(self, fp, filename)
File "venv\lib\site-packages\PIL\TiffImagePlugin.py", line 1810, in _save
e = Image._getencoder(im.mode, "libtiff", a, encoderconfig)
File "venv\lib\site-packages\PIL\Image.py", line 458, in _getencoder
return encoder(mode, *args + extra)
TypeError: argument 3 must be str, not int
However when disabling compression it works:
with Image.open("test.bmp") as im:
im.save("test.tiff", format="TIFF", compression=None)
This seems to be an older issue because I found a StackOverflow question from 2019 mentioning this exact problem: https://stackoverflow.com/q/54181211
Second exception
There also seems to be a regression in 9.1.0 compared to 9.0.1. In 9.0.1 using tiff_lzw compression worked without problems:
with Image.open("test.bmp") as im:
im.save("test.tiff", format="TIFF", compression="tiff_lzw")
However in 9.1.0 I get the following exception:
Traceback (most recent call last):
File "convert.py", line 4, in <module>
im.save("test.tiff", format="TIFF", compression="tiff_lzw")
File "venv\lib\site-packages\PIL\Image.py", line 2300, in save
save_handler(self, fp, filename)
File "venv\lib\site-packages\PIL\TiffImagePlugin.py", line 1810, in _save
e = Image._getencoder(im.mode, "libtiff", a, encoderconfig)
File "venv\lib\site-packages\PIL\Image.py", line 458, in _getencoder
return encoder(mode, *args + extra)
ValueError: Requiring 768 items for Colormap
OS, Python and Pillow versions:
- OS: Windows 10
- Python: 3.9 x64
- Pillow: 9.1.0
https://stuff.realpath.org/test.bmp is a very simple BMP image (unfortunately GitHub doesn't allow to attach it here).
First exception
When I try to convert it to a TIFF:
I get the following exception:
However when disabling compression it works:
This seems to be an older issue because I found a StackOverflow question from 2019 mentioning this exact problem: https://stackoverflow.com/q/54181211
Second exception
There also seems to be a regression in 9.1.0 compared to 9.0.1. In 9.0.1 using
tiff_lzwcompression worked without problems:However in 9.1.0 I get the following exception:
OS, Python and Pillow versions: