Create MACOS Finder Tags from exif Keywords....again

Started by 30west, December 11, 2021, 06:38:15 PM

Previous topic - Next topic

30west

I DO have exiftool AND the Tag utility installed .

I tried the following test command:

% exiftool -p 'tag -a '$keywords' $/Users/self/Pictures/PhotoFolder/Photo1' -sep ',' /Users/self/Pictures/PhotoFolder | source /dev/stdin

This returned about a mile of error messages. The real goal would be to take the content of a hierarchy of photo folders (MasterPhotoFolder), read the keywords and write those keywords as MACOS Finder Tags into the same photo files. I have seen this posted before, but really missed or could not follow the answer. I have seen several posts looking for the same capability. I either missed, and can't find the solution posted or it was out of my depth. I would be very grateful for a command:

1. Read Keywords in folder (Photos) 2. Create MACOS finder Tags of the same name and write them into the same files

ie. "Read Keywords in" /Users/self/Photos (recursively) then "Write MACOS finder Tags in" /Users/self/Photos (recursively)

again many thanks if anyone can provide the answer



Phil Harvey

You are overthinking this (and maybe didn't know about the ExifTool MacOS MDItem tags).  Here is the command you need (assuming your keywords are stored in IPTC:Keywords):

exiftool "-MDItemUserTags<keywords" -r /Users/self/Photos

But more likely they are stored in XMP:Subject.  If so, change "keywords" to "subject" in the above command.

- 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 ($).

30west

Thank you so much, Phil, for the generosity of your time to provide this solution. It works beautifully as written, without the changing of "keywords" to "subject" so apparently the keywords in this case are IPTC values.

For other Mac users on this forum,  this allows one to leverage all the work done in organizing large libraries of photos in proprietary software to gain near "catalog" functionality within the basic operating system using the Finder.

Again, many many thanks.

30west

A "follow-on" to this issue...As I initially replied, this is nothing short of pure magic for "tagging" jpeg files. It turns out that even substituting "keyword" with "subject" when running this command with RAW files, the result is that the XMP sidecars are tagged, but not the actual RAW photo files. It clearly is possible to manually add a tag to a RAW file, but for some reason this command is not doing it.

Any ideas?

thanks

StarGeek

Quote from: 30west on December 12, 2021, 04:43:35 PMIt turns out that even substituting "keyword" with "subject" when running this command with RAW files, the result is that the XMP sidecars are tagged, but not the actual RAW photo files.

This is XMP sidecars are different files and exiftool will only operate on the files you tell it to.  It doesn't do any of the behind the scenes relational tracking that a full fledged DAM such as Lightroom does.

QuoteIt clearly is possible to manually add a tag to a RAW file, but for some reason this command is not doing it.

You would have to add the -TagsFromFile option to the command
exiftool -TagsFromFile %d%f.xmp "-MDItemUserTags<Subject" /Path/to/files/

Here, for every file it processes, exiftool looks for a file in the same directory %d and the same base filename %f but with an XMP extension.  It then will copy the Subject tag of that file to the MDItemUserTags of the current file.  You might want to use the -ext (-extension) option to limit what files get processed.  For example, you may not want the XMP files to have MDItemUserTags set.  You could then use --ext XMP to exclude those from being processed.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

30west

Thank you for this additional instruction.The exact command was:

~ % exiftool -TagsFromFile %d%f.xmp "-MDItemUserTags<Subject" -r /Users/gary/Pictures/2021raw

However, when I run it, I get these errors:

Warning: Error 32512 running "tag" to set MDItemUserTags - /Users/gary/Pictures/2021raw/2021_02_Maine33.xmp
Warning: Error opening file - /Users/gary/Pictures/2021raw/2021_02_Maine60010.xmp
Warning: Error opening file - /Users/gary/Pictures/2021raw/2021_02_Maine60004.xmp
Warning: Error 32512 running "tag" to set MDItemUserTags - /Users/gary/Pictures/2021raw/2021_02_Maine11.RW2
Warning: Error 32512 running "tag" to set MDItemUserTags - /Users/gary/Pictures/2021raw/2021_02_Maine10.RW2

with similar errors in each file in the folder.

Any additional insight will be much appreciated

Phil Harvey

You need to have "tag" installed.  What happens if you just run "tag" from the command line?

The other warnings are files that don't have XMP sidecars.

- 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 ($).

30west

YES! that worked!. I had exiftool installed on desktop AND laptop, but the Tag utility only on desktop. When the earlier command worked on the jpegs, I assumed that the tag utility was redundant and was running into the problem on my laptop (without the Tag utility) for the RAW files.

Although this has solved my issue in its entirety, I will continue to study the syntax to try to better understand the process. I am always impressed with the power of the command line, but to paraphrase... it been said "taking this all in is like trying to drink from a fire hose".

Thanks again for hanging in there with me on this. Having MACOS finder tags will never replace the full DAM capability of Adobe Lightroom (classic) etc, but is extremely handy for occasional use.