0

I'm using the PIL librarie to get metadata of some photos, but I'm experimenting some problems, and I didn't find a web where read a full documentation.

I'm talking specifically about the ._getexif()

There's a simple example:

from PIL import Image

img = Image.open('DSC02619.JPG')

print( img._getexif()[36869] )

I found that the number 36869 returns the date, and I'm using it. But...

Why some photos returns me 'NoneType' object is not subscriptable ?

Why I'm using exactly this number? What other information can I get with getexift()?

I've been searching there: https://pillow.readthedocs.io/en/5.1.x/index.html#, but my questions were not answered.

  • If an image does not have EXIF, `.getexif` naturally returns `None`, to which you cannot apply the selection operator `[]`. You must check the returned value before indexing it. – DYZ Aug 17 '18 at 03:40
  • Maybe because it contains no exif data. Perhaps you can try printing out the value returned by `_getexif`? There are also some suggestions [here](https://stackoverflow.com/questions/4764932/in-python-how-do-i-read-the-exif-data-for-an-image). The [ExifTags](https://pillow.readthedocs.io/en/5.1.x/reference/ExifTags.html) module looks promising. Note also the function has a leading underscore and there might not be expected to be fully documented. – Paul Rooney Aug 17 '18 at 03:41
  • Did you try to google "36869 EXIF"? The [list of EXIF tags](https://github.com/spillz/picty/blob/master/utils/exif-tags) has nothing to do with Pillow. In fact, your whole question has nothing to do with Pillow. – DYZ Aug 17 '18 at 03:41

0 Answers0