1

I am using:

  • Python 3.8.5
  • Pillow 8.2
  • ExifRead 2.3.2

I am trying to extract the EXIF data from this image (as a random example).

Here is what I have tried so far:

using ExifRead:

import exifread

with open('/path/to/image/file', 'rb') as f:
    tags = exifread.process_file(f)


print(tags) # No EXIF data found

Using PIL

from PIL import Image

img = PIL.Image.open('/path/to/image/file')
exif_data = img.getexif()

Again, this produces paltry results

However, when I upload the same photo to an oline exif data checking service, I get the full EXIF data.

How can I fix my code so that I can extract the same data that is available to exifdata.com?

Homunculus Reticulli
  • 65,167
  • 81
  • 216
  • 341
  • import PIL.Image img = PIL.Image.open('img.jpg') exif_data = img._getexif() – pippo1980 Jun 22 '21 at 10:07
  • Does this answer your question? [In Python, how do I read the exif data for an image?](https://stackoverflow.com/questions/4764932/in-python-how-do-i-read-the-exif-data-for-an-image) – pippo1980 Jun 22 '21 at 10:09
  • 1
    @pippo1980: The suggested links do not help - in fact, the code I am testing came directly from those links. The Image interface has changed, and the `_getexif()` method has been replaced by `getexif()`. – Homunculus Reticulli Jun 22 '21 at 10:53
  • tried to ask here: https://github.com/python-pillow/Pillow/discussions ? – pippo1980 Jun 22 '21 at 14:08
  • oes https://exiftool.org/ works? – pippo1980 Jun 22 '21 at 14:14
  • @HomunculusReticulli `_getexif` probably still provides more information than `getexif`, cf. [this Q&A](https://stackoverflow.com/q/68033479/11089932). Do you have access to the real image you linked - or do you use preview? In the first case, how should people here be able to reproduce any results? Likely no one will pay any money to get that image. On the other hand, if you use the preview, what results do you exactly get when feeding to the linked service - for comparison? – HansHirse Jun 23 '21 at 06:42
  • Your question asks for extracting EXIF, not XMP or IPTC. I think you already get what you ask for. – AmigoJack Jun 28 '21 at 13:18

0 Answers0