Author Topic: Creating keyword from FocusMode  (Read 1012 times)

illicit1

  • Jr. Member
  • **
  • Posts: 11
Creating keyword from FocusMode
« on: December 19, 2017, 12:22:23 PM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16879
    • ExifTool Home Page
Re: Creating keyword from FocusMode
« Reply #1 on: December 19, 2017, 12:51:32 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

illicit1

  • Jr. Member
  • **
  • Posts: 11
Re: Creating keyword from FocusMode
« Reply #2 on: December 19, 2017, 12:57:12 PM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16879
    • ExifTool Home Page
Re: Creating keyword from FocusMode
« Reply #3 on: December 19, 2017, 01:00:01 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

illicit1

  • Jr. Member
  • **
  • Posts: 11
Re: Creating keyword from FocusMode
« Reply #4 on: December 19, 2017, 01:14:29 PM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16879
    • ExifTool Home Page
Re: Creating keyword from FocusMode
« Reply #5 on: December 19, 2017, 01:20:22 PM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

illicit1

  • Jr. Member
  • **
  • Posts: 11
Re: Creating keyword from FocusMode
« Reply #6 on: December 19, 2017, 01:23:14 PM »
Ahh, didn't need the quotes at all around the directory.

Thanks for all your help, what a wonderful tool.