You probably have an incomplete installation of the Python Imaging Library (PIL), which SciPy relies on when reading the image. PIL uses the libjpeg package to download JPEG images and the zlib package to download PNG images, but can be installed without them (in this case, it cannot download any images for which there are no libraries).
I had exactly the same problem as you described above for JPEG images. No error messages are issued, but rather, calling SciPy simply returns the wrapped PIL object, rather than loading the image into the array properly, which makes it especially difficult to debug. However, when I tried to load the image using PIL directly, I got:
> import Image > im = Image.open('001988.jpg') > im <JpegImagePlugin.JpegImageFile image mode=RGB size=333x500 at 0x20C8CB0> > im.size > (333, 500) > pixels = im.load() IOError: decoder jpeg not available
So I deleted my copy of PIL, installed the missing libjpeg (in my case, probably zlib in yours), reinstalled PIL to register the library, and now loading images using SciPy works fine:
> from scipy import ndimage > im = ndimage.imread('001988.jpg') > im.shape (500, 333, 3) > im array([[[112, 89, 48], ... ..., dtype=uint8)
Ken chatfield
source share