1

I tried the following codes from Working with TIFFs (import, export) in Python using numpy :

from PIL import Image
im = Image.open('Park_Falls.tif')
im.show()

AND

import matplotlib.pyplot as plt
im = plt.imread('Park_Falls.tif')
print im

But both didnt work for me.

IOError: cannot identify image file <open file 'Park_Falls.tif', mode 'rb' at 0x0000000022FB71E0>

Why? Is it because the TIFF image is too large (292 MB after unzipping) in size?

Image taken from here (Park_Falls.zip)

Community
  • 1
  • 1
Nancy
  • 315
  • 1
  • 5
  • 16
  • Have you tried using other (smaller) TIFF files? – Christoph Sep 08 '15 at 12:59
  • Yes,with smaller TIFFs the code runs fine. Could the problem be related to the size of the file? – Nancy Sep 08 '15 at 13:04
  • You could probably try that by converting a sufficiently large JPEG (or any other non-tif format) into a TIF using whatever tools you have available. – Christoph Sep 08 '15 at 13:19
  • it's saying it can't recognize it as a TIFF file... it could have been too big, but i'd expect an 'out of memory' error or something like that instead. can you open it in other programs (e.g. photoshop, windows image viewer)? (looks like you have to have access to see the actual files...) from this page: http://pillow.readthedocs.org/en/latest/handbook/image-file-formats.html it looks there are some types of compressed TIFF files it doesn't support, but if you install the module libtiff it can... maybe look into that? – Corley Brigman Sep 08 '15 at 13:37
  • @Corley I could view the image in Global Mapper(sorry but I don't remember from where I came to know about this GIS), not in Windows Image Viewer or PS. Also, I could only read the data(the array values) using gdal only. – Nancy Sep 09 '15 at 05:37
  • try installing libtiff and see if it helps then, maybe... if PS can't open it, then it's a 'weird' tiff file, and you might need some help. – Corley Brigman Sep 09 '15 at 12:59
  • Park_falls*.tif is an uncompressed float32 RGB image. [GDAL](https://pypi.python.org/pypi/GDAL/) and [tifffile.py](http://www.lfd.uci.edu/~gohlke/code/tifffile.py.html) are able to read the file. – cgohlke Sep 13 '15 at 07:46

0 Answers0