user15653028
user15653028

Reputation:

Issue in producing arrays out of tiff images

My main aim is to produce 1D array out of each image in the 'dengue' folder. For which I used below code to read the file using both PIL and GLOB.

from PIL import Image import glob

image_list = []
for filename in glob.glob('./dengue/*.tiff'): 
    im=Image.open(filename)
    image_list.append(im)

OUTPUT IS -

UnidentifiedImageError: cannot identify image file './dengue/image_2016-09-18.tiff

How to resolve this? The same error showed up for numerous other images.

Or is there any other way I can read each of these tiff images to produce 1D array out of them? Thank you so much for your time.

Upvotes: 0

Views: 259

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 207385

Use one of the following tools to see the difference between a TIFF file you can read and one you cannot:

exiftool UNHAPPY.TIF

or, with tiffinfo from libtiff:

tiffinfo UNHAPPY.TIF

or, with ImageMagick:

magick identify -verbose UNHAPPY.TIF

My guess would be you have an unsupported compression or pixel type.

Upvotes: 1

Related Questions