Sumit Sikri
Sumit Sikri

Reputation: 11

Unable to open an image through PIL in googlecolab

  !wget https://github.com/lazyprogrammer/machine_learning_examples/blob/master/cnn_class/lena.png
  from PIL import Image 
  im =Image.open('lena.png')

UnidentifiedImageError Traceback (most recent call last) in () ----> 1 im =Image.open('lena.png')

/usr/local/lib/python3.6/dist-packages/PIL/Image.py in open(fp, mode) 2929 warnings.warn(message) 2930 raise UnidentifiedImageError( -> 2931 "cannot identify image file %r" % (filename if filename else fp) 2932 ) 2933

UnidentifiedImageError: cannot identify image file 'lena.png'

Upvotes: 0

Views: 247

Answers (1)

abjklk
abjklk

Reputation: 11

The link you are using to wget is all wrong. You are actually sending a GET request to the html file instead of the image. Here's the actual image link for you :)

https://raw.githubusercontent.com/lazyprogrammer/machine_learning_examples/master/cnn_class/lena.png

Upvotes: 1

Related Questions