Keep that exif please!

One of the bad habits of gmic (the only one perhaps?) is that it throws away all the exif information in a photo. This post describes how we can repair that using the widely used command line program exiftool.

Important update! I recently discovered that this Exif info is thrown away only by the commandline version of gmic, but when you use the G’MIC plugin for Gimp, some of the (most relevant) Exif info is still there after you save (export) the photo. Apparently Gimp takes care of that!

Without exif information, a gmic processed photo cannot be auto-rotated based on the corresponding exif fields anymore. But also the maker notes, copyright info and information like lens/camera combination, shutter speed, diaphragm, et cetera is gone – for ever! That’s a pity because when I surf around on Flickr, I am sometimes interested in what lens was used for example, or what aperture. So we must repair the exif info. And we can!

This is when we ask Flickr to show the exif information of a photo that is processed by gmic. Not really informative…

show.exif.gmic

To get back that exif info we use a separate and well-known program called exiftool, written by Phil Harvey. This is a Perl library that can do everything you can think about with exif info. Plus much more. On Linux you can find this software in your package manager; ready to run packages for Mac OS X and Windows can be downloaded via this link.

The master himself explained how to transfer the original exif info to another photo, in our case a gmic processed photo. That command looks like this:

$ exiftool -wm cg -tagsfromfile “org.jpg” -all:all “processed.jpg”

To integrate this with our gmic command that we made in the article Gmic batch processing – part II, we must say:

$ gmic image.jpg -my_nr -my_octave -o processed.jpg; exiftool -wm cg -tagsfromfile “image.jpg” -all:all “processed.jpg”; rm *_original

Now an application like Flickr shows again the information that can be of interest to other photographers.

exif

To do the same action on multiple photos in a certain directory, say this:

for i in *.jpg; do echo $i; gmic $i -my_nr -my_octave -o gmic.processed.$i; exiftool -wm cg -tagsfromfile “$i” -all:all “gmic.processed.$i”; rm *_original;done

When exiftool copies the exif info into a new file, it always keeps the original file that is renamed to image.jpg_original. That’s why I added the rm command at the end of the line, because we don’t need them here (alternatively you can use an exiftool switch that does the same).

hor.bar
pm|jun16

Advertisements