user3320033
user3320033

Reputation: 245

cannot open an image file in python

import Image


imageFile = "C:\Users\Abhi\Desktop\cbir-p\images.jpg"
im1 = Image.open(imageFile)



Error: 
File "C:\Users\Abhi\Desktop\cbir-p\im1.py", line 5, in <module>
    im1 = Image.open(imageFile)
  File "C:\Python27\lib\site-packages\PIL\Image.py", line 2025, in open
    raise IOError("cannot identify image file")
IOError: cannot identify image file

help me, I have installed all the necessary packages PIL ,Pillow ,Opencv etc.

Upvotes: 1

Views: 4497

Answers (1)

nancy_yeah
nancy_yeah

Reputation: 69

hey it's not for your file path problem...

it's for your missing JPEG support in your PIL here is my solution explained here. https://apple.stackexchange.com/questions/59718/python-imaging-library-pil-decoder-jpeg-not-available-how-to-fix

Go to here to download the lib libjpeg package. or just

brew install libjpeg

enter image description here

Upvotes: 1

Related Questions