Copy link to clipboard
Copied
Would you kindly help me automate the following operations? I have to modify 547 images, and it'll take me 10-12 hours by hand. I'm embedding the image filename below the image for placement on a website.
FWIW, I'm an event photographer. I work almost exclusively in Lightroom Classic and DxO PhotoLab and have long since forgotten most of what I knew about Photoshop 20 years ago.
Any suggestions would be most welcome. Thanks! An example file is attached.
I usually receive the spreadsheet from clients/interns but I've done it 2-3 times on my own using Excel/Google Spreadsheets and Windows Explorer. I know I did it once with full paths but if you want to shorten the path to just the filenames...
Here
This new script will handle the batch processing and saving into PSD and PNG versions, it is self-contained, and there is no need to record actions for use with Automate/Batch or Image Processor Pro. You will be prompted to select an input folder and an output folder.
Note: All input files are expected to have a resolution of 300ppi (as per your sample) for the text size to be consistent/correct.
/*
Batch Add Filename to 1800x1200px Images & Save PSD & PNG.jsx
https://community.adobe.com/t5/
...
I am just needing the script to output it as a jpg only (not psd or png)
By @Shoua5C98
Try this script, it should be close enough and can be easily tweaked if you need it "pixel perfect" to your samples. Let me know if there are any major issues that you can't figure out:
/*
Batch Add Filename to Lower Right of Canvas.jsx
https://community.adobe.com/t5/photoshop-ecosystem-discussions/please-help-with-simple-automation-add-filename-text-below-image/td-p/13652732
v1.0, 1st August 2023, Steph
...
Copy link to clipboard
Copied
Thank you. I really appreciate your time and expertise. I spent hours trying to figure it out to no avail.
Copy link to clipboard
Copied
As all samples are normalised to 300ppi results should at least be consistent.
Copy link to clipboard
Copied
I am just needing the script to output it as a jpg only (not psd or png)
Copy link to clipboard
Copied
I am just needing the script to output it as a jpg only (not psd or png)
By @Shoua5C98
Try this script, it should be close enough and can be easily tweaked if you need it "pixel perfect" to your samples. Let me know if there are any major issues that you can't figure out:
/*
Batch Add Filename to Lower Right of Canvas.jsx
https://community.adobe.com/t5/photoshop-ecosystem-discussions/please-help-with-simple-automation-add-filename-text-below-image/td-p/13652732
v1.0, 1st August 2023, Stephen Marsh
*/
#target photoshop
// Set the input and output folders
var inputFolder = Folder.selectDialog("Please select the input folder:");
var outputFolder = Folder.selectDialog("Please select the output folder:");
// Limit the input files, add or remove extensions as required
var fileList = inputFolder.getFiles(/\.(webp|tif|tiff|jpg|jpeg|psd|psb|png)$/i);
fileList.sort();
// Set the dialog and ruler options
var savedDisplayDialogs = app.displayDialogs;
app.displayDialogs = DialogModes.NO;
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
// Set the file processing counter
var fileCounter = 0;
// Process the input files
for (var i = 0; i < fileList.length; i++) {
open(fileList[i]);
//activeDocument.resizeImage(null, null, 300, ResampleMethod.NONE);
var docName = activeDocument.name.replace(/\.[^\.]+$/, '');
var textLayer = activeDocument.artLayers.add();
textLayer.kind = LayerKind.TEXT;
var theText = textLayer.textItem;
var theColor = new SolidColor;
theColor.rgb.red = 255;
theColor.rgb.green = 255;
theColor.rgb.blue = 255;
textLayer.textItem.color = theColor;
theText.position = [500, 500];
theText.justification = Justification.RIGHT;
//theText.font = 'Arial-Regular';
theText.font = 'ArialMT';
theText.size = 8;
theText.contents = docName;
alignToSel('AdRg');
alignToSel('AdBt');
activeDocument.activeLayer.translate(-25, -25);
var saveJPEGName = File(outputFolder + "/" + docName + ".jpg");
saveJPEG(saveJPEGName);
activeDocument.close(SaveOptions.DONOTSAVECHANGES);
fileCounter++;
}
app.displayDialogs = savedDisplayDialogs;
app.preferences.rulerUnits = originalRulerUnits;
alert('Script completed!' + '\n' + fileCounter + ' files saved to:' + '\r' + outputFolder.fsName);
// FUNCTIONS //
function alignToSel(method) {
/* https://gist.github.com/MarshySwamp/df372e342ac87854ffe08e79cbdbcbb5 */
//www.ps-scripts.com/viewtopic.php?f=66&t=7036&p=35273&hilit=align+layer#p35273
/*
//macscripter.net/viewtopic.php?id=38890
AdLf = Align Left
AdRg = Align Right
AdCH = Align Centre Horizontal
AdTp = Align Top
AdBt = Align Bottom
AdCV = Align Centre Vertical
*/
app.activeDocument.selection.selectAll();
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
desc.putReference(charIDToTypeID("null"), ref);
desc.putEnumerated(charIDToTypeID("Usng"), charIDToTypeID("ADSt"), charIDToTypeID(method));
try {
executeAction(charIDToTypeID("Algn"), desc, DialogModes.NO);
} catch (e) { }
app.activeDocument.selection.deselect();
}
function saveJPEG(saveFile) {
var jpgOptns = new JPEGSaveOptions();
jpgOptns.formatOptions = FormatOptions.STANDARDBASELINE;
jpgOptns.embedColorProfile = true;
jpgOptns.matte = MatteType.NONE;
jpgOptns.quality = 10;
activeDocument.saveAs(saveFile, jpgOptns, true, Extension.LOWERCASE);
}
Copy link to clipboard
Copied
THIS IS EXACTLY WHAT I NEEDED!!! What a HUGE time saver!! Thank you so much!!
Copy link to clipboard
Copied
THIS IS EXACTLY WHAT I NEEDED!!! What a HUGE time saver!! Thank you so much!!
By @Shoua5C98
You're welcome!
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Is it possible to change this script so it saves the file with a JPG extension instead of PSD ?
Copy link to clipboard
Copied
Making a comment- I am totally over-whelmed by scripting (Don't know anything!). But if you are using Lightroom-Classic, you can do this function (Save as JPG with FIlename, or other metadata) so easily with Lr-Classic.
-Select photos (as many as you want!) in the LrC library
-Use the Print Module to Design the 'page' with 'Photo Info' metadata.
- with the [Print Job] set to JPG Save all images to JPG.
Copy link to clipboard
Copied
Lightroom can also output files with a watermark.
I use a Photoshop script at work to create stylized text but yes it would probably be a bit overwhelming for someone without coding knowledge.
Copy link to clipboard
Copied
Is it possible to change this script so it saves the file with a JPG extension instead of PSD ?
By @Michael37981923jv7y
Which script, there are multiple scripts in this topic.
Copy link to clipboard
Copied
Thanks for the suggestion, but wouldn't this just append the same single filename entered in step 5 to all 547 images? I want each image to have its own filename appended. In any case, I got it done with Variables, as noted above.
Copy link to clipboard
Copied
Thanks for the suggestion, but wouldn't this just append the same single filename entered in step 5 to all 547 images?
By @JacquesCornell
The message you replied to used ChatGPT and contained a spam link. It has been removed from the thread.
Jane