Stripping image metadata in Python

Currently, as part of my file deduper,  I’m opening images, copying the image data to a new file, and saving that file.This is done using the Python Imaging Module, or PIL. I’m actively using an updated fork of it called pillow.

However, I’ve since discovered pyexiv2, something that says it allows the “access of … XMP metadata”. Which means it might allow XMP data access in .DNG files. The exiv2 docs say this is possible, at least.

This interests me because using DNG was something I tried, but then went back to .CR2 simply because using .CR2 forced Lightroom to keep the metadata & data in separate files. I do have a bunch of .DNG files from that period though that aren’t working with my deduper because the metadata changed enough, so this module would probably be a good addition to my growing toolkit.

My chosen method of copying & wiping metadata, like I did with mp3 files, should work the same way. Just a matter of finding the pyexiv2 command for deleting image metadata, something which exiv2 states is possible, but I can’t seem to find in the pyexiv2 docs.

, , ,

  1. No comments yet.
(will not be published)