To burn metadata into the image or not to burn metadata into the image?

Started by eco, October 11, 2020, 06:16:16 AM

Previous topic - Next topic

eco

Hi all,

I wanted your expert opinion before I pull the trigger on modifying 60K pictures. Over the years I have tried many photo managers (digiKam, Aperture, Photos, Lightroom, ...) but each time I Geo tag my pics and each time they seem to write it in their DB so that when I change I lose all the work I did tagging the pictures.

I wrote a python script that parses the databases and writes the Geo tag (using ExifTool) directly into the image to make sure that I won't have to do the work again the next time I change photo manager. I tested it and it works great, but now I'm about to pull the trigger and thought I'd do better to ask if this was the right way to go?

This is what I'll be doing on each picture:
/usr/local/bin/exiftool -quiet -preserve -overwrite_original_in_place -gpslatitude={} -gpslongitude={} "{}"

Is this the right way to go? Maybe XMP but if so, how long until it is legacy and I have to do the work again? Any thought or advice is welcome.

Thank you :)

Phil Harvey

This command will write EXIF GPSLatitude/Longitude, so you need to also write GPSLatitudeRef and GPSLongitudeRef.  This method of storing GPS should be good for many years to come.

What file types are you writing?  JPG I assume.  For other file types you may want to write other tags.

Are on a Mac?  The -overwrite_original_in_place will slow down processing by a factor of 2, so if you aren't on a Mac or don't need to keep the extended file attributes, you may want to drop this and do just -overwrite_original.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

eco

Hi Phil,
Thanks for taking the time.

I currently am on a mac yes. Mostly, files are JPG but I have a few other formats:
3gp CR2 jpg avi dng heic jpg_original m4v mov mp4 mpg png psd raw tiff
Some of these are video and I still need to figure out how to handle them.

I'll read up on GPSLatitudeRef and GPSLongitudeRef as well as overwrite_original_in_place vs overwrite_original. Thank you for confirming I am on the right path and thanks for such an amazing tool!

Phil Harvey

For TIFF-based files (including most raw files), your command should work, but be careful with raw files to make sure any changes are compatible with the software that you use.

For the QuickTime-based videos you should write GPSCoordinates, but "where?" is the question.  Maybe in the Keys metadata, but I'm not sure.  You'll have to run some tests.

For AVI, you're currently out of luck since ExifTool doesn't write these yet.

For PNG, I don't know if there is any place to put there where an application other than ExifTool will read it.  Maybe XMP is the best way to go here.

The command should work for HEIC, but I'm not sure what software will read this metadata.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Alan Clifford

How many of those file formats don't support xmp?

How about putting your gps information in xmp anyway?  If you need it somewhere else in years to come, you can copy it from xmp.

Phil Harvey

Duplicating this in XMP is a good idea.  All those formats support XMP.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

eco

Thank you both for your feedback. Would you agree with a hybrid solution such as:

Writing Geo tags to file for JGP and to an XMP for all other format that isn't video (or would XMP work for video as well?).

That way, most of my files are done regardless of the new Photo Manager and for the other formats I can hope XMP will be supported.

So now I have to find a way to write XMP or append to XMP with Python. I'm sure there is a library for that.. the hunt begins.

Phil Harvey

Why do you need the XMP Python library?  ExifTool will format the XMP for you, and I doubt you will find a Python library to write these file formats, so you will likely have to use ExifTool to embed the XMP anyway.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

eco

Sorry for the late reply. I had not seen your lat answer. It's a good thing I haven't had the time to start.

I'll have a look at how to work with XMP using ExifTools.

Thanks again for your help.

Alan Clifford

Quote from: eco on October 11, 2020, 12:01:03 PM

Writing Geo tags to file for JGP and to an XMP for all other format that isn't video (or would XMP work for video as well?).

"... to an XMP ..." suggests you are thinking about a sidecar file.  Why not write it to the file alongside the exif data?

Alan Clifford

Quote from: eco on November 19, 2020, 06:10:50 AM

I'll have a look at how to work with XMP using ExifTools.


If it helps, this is the exiftool command I use to insert gps data after I've gathered it into bash variables from my gps tracker files

    exiftool -m -P  -exif:gpslatitude=${gpslatitude} -exif:gpslatituderef=${gpslatituderef} \
      -exif:gpslongitude=${gpslongitude}  -exif:gpslongituderef=${gpslongituderef} \
      -exif:gpsaltitude=${gpsaltitude} -exif:gpsaltituderef=${gpsaltituderef} \
      -exif:gpsdatestamp=${gpsdatestamp} -exif:gpstimestamp=${gpstimestamp} \
      -xmp:gpslatitude=${xmpgpslatitude} \
      -xmp:gpslongitude=${xmpgpslongitude} \
      -xmp:gpsaltitude=${gpsaltitude} -xmp:gpsaltituderef=${gpsaltituderef} \
      -xmp:gpsdatetime="${xmpgpstimestamp}" \
      -overwrite_original -previewimage= -thumbnailimage= \
      "${xmpphoto}"  >&2


eco

Quote from: Alan Clifford on November 19, 2020, 09:03:56 AM

If it helps, this is the exiftool command I use to insert gps data after I've gathered it into bash variables from my gps tracker files


Hi Alan,

thank you so much for this. I will start consolidating all my commands and try and come up with a good way to do this. I expect using XMP is probably the best way to go.