ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: DGMAC on September 06, 2017, 03:45:47 PM

Title: copy keywords to description for Google Photos
Post by: DGMAC on September 06, 2017, 03:45:47 PM
Background: our organization has thousands of photos with keyword metadata added in Bridge to the keywords field. We are looking into migrating our photos to Google Photos for its powerful intelligent search features, but it does not search the keywords field. It does however search the description field, so I am exploring how best to copy the keyword data to the description field so that the existing keywords will be searchable in Google Photos. I am new to ExifTool.

Task: copy the keyword field to the description field for an entire folder and subfolders, including jpg, png, cr2, nef, and tiff files.

I found the following suggestion online that I tested on a folder of 28 files. It successfully copied keyword metadata to the description field for 26 jpg files but not for the lone png and cr2 files:

exiftool −r −overwrite_original -TagsFromFile @ '-Keywords>Description' *

Does anyone see problems with this approach or have suggestions for making it apply not only to jpg but also to png, cr2, nef, and tiff files?
Title: Re: copy keywords to description for Google Photos
Post by: StarGeek on September 06, 2017, 05:13:10 PM
Quote from: DGMAC on September 06, 2017, 03:45:47 PMexiftool −r −overwrite_original -TagsFromFile @ '-Keywords>Description' *

That should work fine. (but see below)

Quote from: DGMAC on September 06, 2017, 03:45:47 PMIt successfully copied keyword metadata to the description field for 26 jpg files but not for the lone png and cr2 files:

Did exiftool say it couldn't copy, or did the copied keywords just not show up in Google Photos?

I suspect that later.  Google Photos has almost no support for metadata in PNG files last time I checked and I'd be surprised if it was any different for NEF or CR2 files.  Not sure about TIFF, though it wouldn't surprise me if Google Photos did support it.

**Runs off to re-test**

Color me surprised.  I uploaded a PNG and a TIFF and in both cases it read a lot of the metadata, so that's a good sign.

On the other had, checking in Adobe Bridge, saving a keyword to my test PNG only saved it to XMP:Subject, which is the XMP tag for keywords.  I'd suggest changing your command from '-Keywords>Description' to '-Subject>Description'.
Title: Re: copy keywords to description for Google Photos
Post by: DGMAC on September 06, 2017, 06:04:23 PM
Thanks for the quick reply. It was exiftool that said it couldn't copy the png and cr2 files:

Warning: No writable tags set from IMG_1530.CR2
Warning: No writable tags set from IMG_1530.xmp
Warning: No writable tags set from IMG_0876.png

I tried replacing {exiftool −r −overwrite_original -TagsFromFile @ '-Keywords>Description' *} with {exiftool −r −overwrite_original -TagsFromFile @ '-Subject>Description' *} and nothing happened except a new line in the terminal showing only a < (with no directory path, and no commands working until I exited and restarted Terminal). Ideally I'd like one command to apply to all picture files.

The keywords for the png file are in 'keywords' under 'IPTC Core', and if I 'Get Info' on the png file it lists the keyword metadata under 'Keywords:' (the same as the jpg files).

FWIW I'm using OS X El Capitan 10.11.6, ExifTool version 10.61.

Thanks for any help.

Title: Re: copy keywords to description for Google Photos
Post by: StarGeek on September 06, 2017, 07:00:39 PM
Quote from: DGMAC on September 06, 2017, 06:04:23 PM
Thanks for the quick reply. It was exiftool that said it couldn't copy the png and cr2 files:

Warning: No writable tags set from IMG_1530.CR2
Warning: No writable tags set from IMG_1530.xmp
Warning: No writable tags set from IMG_0876.png

That indicates that there wasn't a Keywords tag in the files.  Additionally, Bridge isn't saving data directly to the CR2 file, but is saving it to the XMP Sidecar file.

QuoteI tried replacing {exiftool −r −overwrite_original -TagsFromFile @ '-Keywords>Description' *} with {exiftool −r −overwrite_original -TagsFromFile @ '-Subject>Description' *} and nothing happened except a new line in the terminal showing only a < (with no directory path, and no commands working until I exited and restarted Terminal).
If that's a direct copy of your command, then the error is in your quote.  Your second command uses a backtick or a fancy quote (not sure which), not a single quote.  Here I've increased the font size of the quotes to make it more apparent.
'-Subject>Description'
This is why nothing happened.  Try again with:
exiftool −r −overwrite_original -TagsFromFile @ '-XMP:Subject>Description' *

QuoteThe keywords for the png file are in 'keywords' under 'IPTC Core', and if I 'Get Info' on the png file it lists the keyword metadata under 'Keywords:' (the same as the jpg files).

Yes, IPTC Core are XMP tags (see IPTC Core XMP Schema PDF (https://www.iptc.org/std/Iptc4xmpCore/1.0/specification/Iptc4xmpCore_1.0-spec-XMPSchema_8.pdf) for the dry technical details).  Keywords are saved to XMP:Subject under IPTC:Core.  For jpg files, Bridge will also save to the IPTC Legacy tag of IPTC:Keywords, at least under Windows, though it's probably the same for Mac since your first command worked for the jpgs.

I checked Google Photos with a DNG, a NEF, and a CR2 and it didn't read any metadata from either of those files, even though the files had metadata in the files.  There probably isn't a solution for those file types except to create a jpg copy. 

Title: Re: copy keywords to description for Google Photos
Post by: DGMAC on September 07, 2017, 12:03:21 PM
Awesome, this works great. Thanks for the explanation and good catch on the fancy quote; apparently the Mac 'Notes' app that I typed it in is not plain text like Notepad in Windows. I guess for the RAW files it won't hurt to have a searchable jpg copy.

Is it possible to modify the command below to also append the text of the original directory path to the description? This would be helpful to locate the photos on our server, since Google Photos does not preserve folder structure. Thanks for your help.

exiftool −r −overwrite_original -TagsFromFile @ '-XMP:Subject>Description' *

Title: Re: copy keywords to description for Google Photos
Post by: StarGeek on September 07, 2017, 02:16:50 PM
Yes, with a slight change to the order of the tags and a slight change to the format of the tags.

If you want to include the full path including the filename, try this:
exiftool −r −overwrite_original -TagsFromFile @ '-Description<$XMP:Subject $FilePath' *

If you want just the directory path:
exiftool −r −overwrite_original -TagsFromFile @ '-Description<$XMP:Subject $Directory' *
Title: Re: copy keywords to description for Google Photos
Post by: DGMAC on September 07, 2017, 03:12:52 PM
Perfect. Thanks for your excellent responses.

For anyone who looks at this thread in the future, one other thing I discovered is that Google Photos may take half an hour after you upload a photo before that photo's metadata will show up in search results.
Title: Re: copy keywords to description for Google Photos
Post by: DGMAC on September 08, 2017, 10:42:11 AM
For the sake of posterity, StarGeek noted on the developer's forum that the asterisk should be removed because of the -r. So the commands now read:

If you want to include the full path including the filename:
exiftool −r −overwrite_original -TagsFromFile @ '-Description<$XMP:Subject $FilePath'

If you want just the directory path:
exiftool −r −overwrite_original -TagsFromFile @ '-Description<$XMP:Subject $Directory'

Link to the thread on the developer's forum regarding using this command in Apple Automator:
https://exiftool.org/forum/index.php/topic,8537.msg43853.html#msg43853 (https://exiftool.org/forum/index.php/topic,8537.msg43853.html#msg43853)
Title: Re: copy keywords to description for Google Photos
Post by: StarGeek on September 08, 2017, 04:10:26 PM
Glad to see you're preventing this:
(https://imgs.xkcd.com/comics/wisdom_of_the_ancients.png)
Wisdom of the Ancients (https://xkcd.com/979/)