1

I use the following code to fetch an image from a url in python :

import urllib
from PIL import Image
urllib.urlretrieve("http://www.gunnerkrigg.com//comics/00000001.jpg", "00000001.jpg")
filename = '00000001.jpg'
img = Image.open(filename)
exif = img._getexif()

However, this way the exif data is always "None". But when I download the image by hand and then read the EXIF data in python, the image data is not None. I have also tried the following approach (from Downloading a picture via urllib and python):

import urllib
f = open('00000001.jpg','wb')
f.write(urllib.urlopen('http://www.gunnerkrigg.com//comics/00000001.jpg').read())
f.close()
filename = '00000001.jpg'
img = Image.open(filename)
exif = img._getexif()

But this gives me 'None' for 'exif' again. Could someone please point out what I may do to solve this problem?

Thank you!

Community
  • 1
  • 1
eknight7
  • 11
  • 3

1 Answers1

0

The .jpg you are using contains no exif information. If you try the same python with an exif example from http://www.exif.org/samples/ , I think you will find it works.

foobarbecue
  • 6,780
  • 4
  • 28
  • 54
  • I have tried it on images that do contain exif information, yet this doesn't work. – eknight7 Oct 24 '13 at 17:43
  • Well, it works for me. Edit your answer to show what image you used that actually contains EXIF. None is the expected outcome for the image in your question, so it's not a question at all. – foobarbecue Oct 24 '13 at 18:19