EXIF AUTOMATION

THE OBJECTIVE

I was looking for a way to:
– Rename the files with the session directory’s name, a four digit counter and a unique identifier
– Fill the metadata fields of filled with values from the file’s path

I’m familiar with Capture One’s token system but at this moment it’s impossible to use the “Document token” (or any other one) to write METADATA fields directly.

(Google and) METADATA indexing

You might find this page about Google and their indexing of METADATA interesting too!

CONTENT

The structure of my sessions disk:

DISK
– / PHOTOS 2020
– – / New Session 2020 (year-month-day eventname)
– – – / Capture
– – – – NEW_SESSION_2020_0001_2DC2549E.arw
– – – – NEW_SESSION_2020_0005_37852F02.arw
– – – – NEW_SESSION_2020_0008_70FC5C95.arw
– – – / Output
– – – – – / Today (Recipe Name)
– – – – NEW_SESSION_2020_0011_8A2855EB.jpg
– – – – NEW_SESSION_2020_0012_07378365.jpg
– – – – NEW_SESSION_2020_0013_23C6F3E1.jpg
– – – / Selects
– – – – NEW_SESSION_2020_0011_8A2855EB.arw
– – – – NEW_SESSION_2020_0012_07378365.arw
– – – – NEW_SESSION_2020_0013_23C6F3E1.arw
– – – / Trash

In my case I want to show the Session Name in the Title field and Filename in the Description field.

MEET EXIFTOOL

The magic will be performed by ExifTool , which you can download here.

For now I’m not going deeper into the possibilities, let’s stick to the subject.
There’s also a lot more documentation and of course more information can be found on the user forums.

With some help of Phil and Stargeek I’ve written a script that will fill some EXIF/IPTC fields.

  1. Download ExifTool and place it in C:/APPS/
  2. Create a new session
  3. Open the session’s directory, you’ll see the four sub directories
  4. Create an empty txt file
  5. Rename the extension from txt to bat
  6. Now right-click and select edit
  7. Paste the code below into the file
  8. Save the bat file(s) in the Session directory

BEFORE YOU CONTINUE

This article is meant to help you to get started.

I advise you to create a test session before using your originals and be careful when customizing the scripts.

I expect you to have some knowledge of programming and I can’t be helt responsible for any problems or errors you might encounter.

Always make sure to test on files that are disposable.

Good luck!

REMARKS

The example code is written for Windows, be aware of a few things to avoid errors or problems

  • This script will change the EXIF of all jpg files in the start directory
  • Add -r at the end of the command to work recursively from the start directory
  • Use (and pay attention to) the right slashes /
  • The double quotes ” might be replaced by accolades ” after copying
  • You might need to use %% instead of %

1 – RENAME: THE RAW FILES

To rename all arw files with the session foldername, a 4 digit counter and a 8 character identifier, use this script. This script will be executed on all arw files in the directory “Capture”

C:/APPS/exiftool.exe -fileOrder DateTimeOriginal "-Filename<${FilePath;$_=(split m(/),$_)[-3];s/ /_/g}_%%1.4C_${Filename;my $x='';$x.=[0..9,'A'..'Z']->[rand 16]for 1..8;$_=$x}.arw" -api "Filter=$_=uc" -ext ARW capture

Example filename: NEW_SESSION_2020_0001_2DC2549E.arw

2 – EXIF: LOAD FILENAME INTO RAW FILE’S EXIF

To fill EXIF fields with the image name and your remarks, use this script.
This script will be executed on all arw files in the directory “Capture”

C:/APPS/exiftool.exe -m -overwrite_original -all= "-Title<${filename;s/_/ /g;s/.ARW//} BY ME" "-Writer-Editor=ME" "-SubjectReference<${filename;s/_/ /g;s/.ARW//} BY ME" -rights="ME.COM, ALL RIGHTS RESERVED" "-by-line=ME" "-credit=CREDIT: ME.COM" "-CopyrightNotice=ALL RIGHTS RESERVED BY ME.COM" "-source=ME.COM" -api "Filter=$_=uc" -ext ARW capture

EXIF Fields filled:

Title: NEW SESSION 2020 0001 2DC2549E BY ME
Description writer: ME
IPTC Subject Code: NEW SESSION 2020 0001 2DC2549E BY ME
Creator: ME
Copyright Notice: ME.COM, ALL RIGHTS RESERVED
Source: ME.COM
Credit Line: CREDIT: ME.COM

COMBINE THE SCRIPTS

It is possible to combine 1 and 2 into one bat file to first rename and right after that fill the EXIF values:

C:/APPS/exiftool.exe -fileOrder DateTimeOriginal "-Filename<${FilePath;$_=(split m(/),$_)[-3];s/ /_/g}_%%1.4C_${Filename;my $x='';$x.=[0..9,'A'..'Z']->[rand 16]for 1..8;$_=$x}.arw" -api "Filter=$_=uc" -ext ARW capture
C:/APPS/exiftool.exe -m -overwrite_original -all= "-Title<${filename;s/_/ /g;s/.ARW//} BY ME" "-Writer-Editor=ME" "-SubjectReference<${filename;s/_/ /g;s/.ARW//} BY ME" -rights="ME.COM, ALL RIGHTS RESERVED" "-by-line=ME" "-credit=CREDIT: ME.COM" "-CopyrightNotice=ALL RIGHTS RESERVED BY ME.COM" "-source=ME.COM" -api "Filter=$_=uc" -ext ARW capture

3 – EXIF: LOAD CAPTURE ONE KEYWORDS INTO JPG FILE’S EXIF

If you want to duplicate the keywords you’ve assigned into another EXIF field, in this case “Description”, use this script.
This script will be executed recursively on all .jpg files starting with the directory “Output” as top level.

C:/APPS/exiftool.exe -m -overwrite_original "-Keywords>Description" -ext jpg output -r