[Python Image Library] saving tif causes unciode error

I’m using PIL (actually PILLLOW) to try to save some LZW compressed tiff images.
But Im hitting a unicode error when I use Image.save()


>>> from PIL import Image
>>> im=Image.open("test.tif")
>>> im
<PIL.TiffImagePlugin.TiffImageFile image mode=RGB size=2048x2048 at 0x2E0C448>
>>> im.save("test2.tif")
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Python27\lib\site-packages\PIL\Image.py", line 1682, in save
    save_handler(self, fp, filename)
  File "C:\Python27\lib\site-packages\PIL\TiffImagePlugin.py", line 1204, in _save
    offset = ifd.save(fp)
  File "C:\Python27\lib\site-packages\PIL\TiffImagePlugin.py", line 531, in save
    data = value = b"" + value.encode('ascii', 'replace') + b"\0"
UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 25: ordinal not in range(128)

But I have little Experience with PIL…any help?

Seems to be a bug deep within TiffImagePlugin.py
Seems to be trying to swap out binary things as ascii …but it’s all a bit beyond me.
I had to switch to a Photoshop script to get the job done.

Revisiting this issue and even though many Python modules for handling TIFF files have been published,
it seems that there is simply no truly robust TIFF compression solutions for python or PIL or Pillow,
at least not one as capable of handling tiff formats as Photoshop.

we avoid TIFFs in favor of simpler formats, like TGA and PNG. Sometimes we save our source files as 32-bit DDS files when we need to save custom mip maps.

I wish PILLOW had a DDS plugin…

I was in fact able to do withWand what Pillow was choking on.