ambigus9
ambigus9

Reputation: 1569

Trying to open tiff file in python getting TiffPage 0: <COMPRESSION.CCITT_T6: 4> not supported

I trying to open TIFF file and getting following error:

TiffPage 0: <COMPRESSION.CCITT_T6: 4> not supported

I using tifffile python library as follows:

import tifffile as tiff 
img = tiff.imread('/tmp/my_filey.tiff') 
img

Thanks!

Upvotes: 0

Views: 2693

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 207465

I have PIL/Pillow installed along with libtiff and am able to read a T6 TIFF with:

fron PIL import Image

im = Image.open('image.tif')

I imagine wand will be able to read your T6 TIFF too, since it is based on ImageMagick which had no problems. I'm not sure how desperately you want to write Python, but you can just convert a T6 TIFF to a PNG or JPEG in your Terminal/shell with ImageMagick using:

magick input.tif output.png

Of course, you could "shell out" from Python and do exactly the same thing with subprocess().


As you were unable to supply a T6 TIFF, I made one with ImageMagick in Terminal:

magick -size 500x500 gradient: -compress Group4 image.tif

You can check the compression with exiftool using:

exiftool image.tif

...
Compression     : T6/Group 4 Fax
...

You can also create a T6 TIFF with tiffcp which comes with libtiff by copying a non-T6 TIFF and specifying T6 compression:

tiffcp -c g4 nonT6.tif T6.tif

Upvotes: 1

Related Questions