News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Creating keyword from FocusMode

Started by illicit1, December 19, 2017, 12:22:23 PM

Previous topic - Next topic

illicit1

I am trying to write a keyword into a .XMP file based on the ARW(sony's raw) EXIF data in the FocusMode field for a specified directory. I found some other examples of this being used but can't seem to get it to quite work.

Can someone help me out here? I would like to add "Manual Focus" or "Auto Focus" as a Keyword. Much appreciated!



Phil Harvey

To add the FocusMode value directly as an XMP keyword:

exiftool "-subject+<focusmode" DIR

- Phil

Edit:  I just checked, and the ARW FocusMode values are "AF-S", "AF-A", "AF-C" or "Manual".  To change these to what you indicated, try this:

exiftool "-subject+<${focusmode;s/^A.*/Auto Focus/;s/^M.*/Manual Focus/}" DIR
...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 ($).

illicit1

Hi Phil,

While this does work, it does create an entire new RAW file (saving the original) and changes the creation/modified date/time. Is there a way to write this just to the XMP sidecar? In theory I would like to run this on a directory with a ton of large RAW images.

Thanks again

Phil Harvey

Ah.  I missed that you want to write the sidecar.  Try this:

exiftool "-subject+<focusmode" -srcfile %d%f.xmp -ext arw DIR

See here for more information about writing sidecar files.

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

illicit1

Excellent, just what I'm looking for.

Unfortunately, I am now running into the problem I had earlier that caused me to come here thinking my syntax was wrong.

I am geting "File Not Found". I know the usage of single and double quotes are different for mac. But I still think I did this right. Any ideas? The directory is correct, it's dragged and dropped.

exiftool '-subject+<focusmode' -srcfile %d%f.xmp -ext arw '/Volumes/2\ Photo\ Drive/Pictures/2017/12/18/'
File not found: /Volumes/2\ Photo\ Drive/Pictures/2017/12/18/

exiftool "-subject+<focusmode" -srcfile %d%f.xmp -ext arw '/Volumes/2\ Photo\ Drive/Pictures/2017/12/18/'
File not found: /Volumes/2\ Photo\ Drive/Pictures/2017/12/18/

Phil Harvey

Just drag and drop the folder onto the Terminal window and it will get the quoting right for you.

You either need backslashes to escape the special characters, or quotes, but I don't think you need both.

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

illicit1

Ahh, didn't need the quotes at all around the directory.

Thanks for all your help, what a wonderful tool.