简体   繁体   中英

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.

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

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM