I am new to Retrobatch. My workflow adds a graphic to one corner of a photo and a text watermark to another corner.
The text is the name of the dog that is in the picture.
I currently use Lightroom and a plugin called LR/Mogrify. I manually add the name of the dog to the Caption field and set the plugin to use the Caption for the text watermark and the export. This works but it is tedious and redundant! It is redundant because the name of the dog is always the first part of the filename. There is an underscore between the dog’s name and the ID number.
The best solution would be to use a string function on the filename and extract the dogs’s name.
The next best solution would be to run Retrobatch for each dog and be prompted for the text watermark.
Basically, the little script looks for the file name, detects if it has an underscore, and then sets the output filename to the letters that come before that. Then in the watermark node, we use the the file name token for the watermark, and it’s good to go.
The output for the file will be the name of the dog, without the underscore and numbers. If that’s a problem- let me know and I can make a slightly more complicated version that writes into metadata.
OK, this is going to require a new build of Retrobatch to work, but I’ve got it going for you now. The new version allows you set set metadata values from JavaScript, which is what we’ll do with the updated version of the workflow.
function processAsset(document, jsnode, asset) {
var fileName = asset.outputFileName();
var underscoreLocation = fileName.indexOf('_');
if (underscoreLocation > 1) {
var newName = fileName.slice(0, underscoreLocation);
// Set the title metadata, using ImageIO keys.
asset.setMetaValue_forPropertyName_inMetaDictionaryName(newName, kCGImagePropertyIPTCObjectName, kCGImagePropertyIPTCDictionary);
}
else {
console.log("Missing underscore in " + fileName)
}
return true;
}