Sort / Classify Images


Is there a way to emit the “Sort / Classify Images” results into a file? I’d like to emit a “image name.txt” for each image that has pertinent information about the image (height, width, exif / iptc data) as well as whatever the 'classifier" found.


There isn’t. I’ll consider that a feature request of course.

So I was working on a JavaScript node, and I figured that writing the classifications to a file would make a nice example, which I’ve got up here:

If you get a chance to try it out, let me know if it works for you or not.

Will do, thanks, I was reading those docs this afternoon.

My use case is I emit photos from Lightroom, I want to process them into HEIF (for photos) and then into a JSON to throw into an ELASTIC instance for retrieval. So I (think) what you’ve created is perfect, I would use the javascript to emit a well-formed JSON file to send to elastic.

Will try it and let you know, thank you


Can you publish the list of methods / functions available on ‘asset’?

(I’m looking to use EXIF and IPTC values in my javascript methods.)

Sorry for the late reply- we’ve been traveling!

I don’t yet have a list of public functions on asset- it’s basically going to be folks asking for things, and then me coming up with something.

Setting metadata is pretty easy to add- but getting the keys and dictionary values is going to be annoying from the programmer’s side. Here’s an example on how to se the DPI:

function processAsset(document, jsnode, asset) {
    asset.setImageMetaDataValue_forKey_inDictionary(123, "DPIWidth", null);
    asset.setImageMetaDataValue_forKey_inDictionary(123, "DPIWidth", null);
    asset.setImageMetaDataValue_forKey_inDictionary(123, "XResolution", "{TIFF}");
    asset.setImageMetaDataValue_forKey_inDictionary(123, "YResolution", "{TIFF}");
    return true;

To get the image metadata, you can call imageMetaData() on asset, which returns a dictionary you can read from.

Is that the type of thing you’re looking for?

Welcome back! I hope the weather was good wherever you went (and I hope it was on holiday and not work)

What I’m trying to do is pull the EXIF/IPTC data and emit them to a JSON sidecar file with the converted image – and more to ‘get’ the metadata, rather then ‘set’. Things like “Title, Description (Caption?), City, Copyright, Aperture, ExpsureTime, ISO, Make, Model, Artists (creator?), CaptureTime,…”

This should do it:

function processAsset(document, jsnode, asset) {
    var dict = asset.imageMetaData();
    if (dict) {
        var data = NSJSONSerialization.dataWithJSONObject_options_error(dict, NSJSONWritingPrettyPrinted, null);
        var name = asset.outputFileName() + ".json";
        var outFolder = jsnode.firstWriteFolderPath();

        data.writeToFile_atomically(outFolder + "/" + name, true);
    return true;

NSJSONSerialization is a Cocoa class that helps with writing out json types.

Perfect, this is exactly what I was looking for.

Unfortunately, I still cannot get RETROBATCH to working on the large image set. It seems the app “just disappears” partway through the data set. I’ve tried TIFF, JPEG,internal and external drives. The images are all an export from LIGHTROOM, so I expect they are all consistent. While attempting the TIFF set, I did get an out of memory error (and a subsequent hard reboot).

I’ve tried to execute RETROBATCH “one at a time” but copying the source file into the input directory, then calling the workflow from the command line. It seems to work, but I get an error after each invocation (I’ve sent a few from the app). The “one at a time” works from the GUI, but if invoked from the command line, I get a

Retrobatch quit unexpectedly.

Any suggestions on using the command line invocation?

I see you’ve sent in a handful of crash reports- thanks for doing that, it’s always helpful for me to track down what’s going on.

It looks like one source of the crash is within the JavaScript interpreter- I’m hopefully going to be able to reproduce that just by throwing a ton of files at it.

The second crash is with a watermark node it looks like. Can you tell me what tokens / strings you have setup in the watermark node? I’d like to see if I can reproduce that crash on my end.

Is this the 7k / 400GB set of images mentioned in another post?