Read Image Rating from DNG File

Hello there,

I am using Keyboard Maestro since version 4 and got around with more or less everything I wanted to do with it until now.
I am absolutely no crack in any programmers language but I usually understand what scripts or small programs do and was able to help myself out with a lot of stuff. Mechanical Engineering is not so far away sometimes :wink:

So, my girlfriend is a professional photographer and used to work with Nikon RAW Files (NEF). With her work in Adobe Lightroom and her workflow she kicked out every picture through a 0-Star Rating meaning every picture that was "worthy" of being used was starred 1-Star or above.
To save space I created a macro in Keyboard Maestro for her which read the content of XMP-Files (Lightroom uses them to store metadata for basically every file format except Adobe's own), getting to the string with the rating and subsequently get the rating of all the files.
If the rating was 0 I let the macro move the NEF and according XMP File into a folder.

Her workflow changed a bit which means she is working with DNG-Files now. That's an Adobe format where the metadata no longer is stored in a separate file but in the DNG-file itself.
Unfortunately I am not able to get the rating out of said DNG-files anymore, probably because - as said above - I am absolutely no pro regarding programming :slight_smile:

Does someone have an idea on how to process such a thing?

Of course if someone is interested I am happy to share my macro!

Thanks in advance!

You might check to see if she's storing that metadata in her DNG or the catalog. She can always save metadata changes to the DNG. See Metadata basics and actions in Lightroom for the details.

Thanks for the tip.

I checked and the information is definitely stored within the DNG.

Is there any command in Keyboard Maestro that s capable of reading those contents?

“Read file” didn’t work with all the given knowledge I have. Or do I maybe need to revert to some other scripts?

As said before I am not super knowledgeable with programming :smile:

I would use an Execute Shell Script action to run Phil Harvey's ExifTool, which will let you read the Exif header of each image file to find the tag and value you need.

ExifTool can be run from the command line or as a Perl script. Either way works in the Execute Shell Script action.

Here's an example that shows all the Exif data in groups for image files selected in the Finder:

50)All Exif Data Grouped Macro (v9.0d2)

50)All Exif Data Grouped.kmmacros (3.7 KB)

Thank you Mike!

Will have a deeper look into the tool and the macros in the weekend and of course keep the topic updated.

Thanks again:+1:

Here I am again and thank you again Mike! :grin:
With the EXIF tool I was able to adapt the macro and it works perfectly now, even for more than just Nikon RAW files but basically everything I want it to work with.

At the moment it is JPG, PNG, DNG and NEF (together with associated XMP). It's easy to add more file types if you do a check if EXIF Tool's capable of reading the file.

If someone want's to have a look into the macro feel free, here it is :smiley:
Find images with 0-Stars to sort into a specifi folder v2.0.kmmacros (23.5 KB)

1 Like