How to extract exif data from a PNG photo?

Question:

I am on OSX, running python and trying to extra EXIF data from a large set of images in my library.
I’ve been using Pillow so far with my JPG photos and it works like a charm.

However, I stumbled on the first PNG photo I hit.

I am able to view a lot of the EXIF data on Mac though, using the photo inspector.

First, it seems that Pillow doesn’t support __get_exif on PNGs.
Then I tried switching into pyexiv2, but that one hits an installation issue.
exiftool also didn’t work for me.

Any idea whether there is a python way of extracting EXIF data on OSX?

Asked By: sramij

||

Answers:

  1. PNG standard just started supporting EXIF in 2017 so make sure it’s EXIF and not other metadata chunks that look like EXIF. See this Stack overflow question and answers for details.

  2. You can use PyExifTool to extract EXIF data.

  3. If you want to use a GUI you can use PyExifToolGui.

  4. Make sure you have the latest version of the command line
    ExifTool
    which recently added PNG EXIF support.

  5. You say that ExifTool doesn’t work for you but don’t give any
    details on what your issues are and perhaps you just need to update
    your version. From the previously referenced thread the ExifTool author states ExifTool supports PNG EXIF:

The PNG group has recently been considering adding a new “eXIf” and/or
“zXIf” chunk to store EXIF information. ExifTool 10.43 added support
for “exIf” and “zxIf” chunks in support of this. – PhilHarvey May 26
’17 at 14:49

Answered By: CoderBlue
Categories: questions Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.