@277251443czo – Try the following script:
/*
Match Color File Pairs From 2 Source Folders.jsx
https://community.adobe.com/t5/photoshop-ecosystem-discussions/regarding-batch-processing-for-color-matching/td-p/13449438
Stephen Marsh, v1.0 - 28th December 2022
Based on:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/batch-script/td-p/12700356
*/
#target photoshop
(function () {
if (app.documents.length === 0) {
try {
// Input folder 1
var folder1 = Folder.selectDialog("Select the source image folder:");
if (folder1 === null) {
alert('Script cancelled!');
return;
}
// Input folder 2
var folder2 = Folder.selectDialog("Select the destination image folder:");
if (folder2 === null) {
alert('Script cancelled!');
return;
}
// Validate input folder selection
var validateInputDir = (folder1.fsName === folder2.fsName);
if (validateInputDir === true) {
alert("Script cancelled as both the input folders are the same!");
return;
}
// Limit the file input to png
var list1 = folder1.getFiles(/\.(png)$/i);
var list2 = folder2.getFiles(/\.(png)$/i);
// Alpha-numeric sort
list1.sort();
list2.sort();
// Validate that folder 1 & 2 lists are not empty
var validateEmptyList = (list1.length > 0 && list2.length > 0);
if (validateEmptyList === false) {
alert("Script cancelled as one of the input folders is empty or doesn't contain PNG files!");
return;
}
// Validate that the item count in folder 1 & 2 matches
var validateListLength = (list1.length === list2.length);
if (validateListLength === false) {
alert("Script cancelled as the input folders don't have equal quantities of images!");
return;
}
// Output folder
var saveFolder = Folder.selectDialog("Please select the folder to save to...");
// Save and set the dialog display settings
var savedDisplayDialogs = app.displayDialogs;
app.displayDialogs = DialogModes.NO;
// PNG save options
var pngOptions = new PNGSaveOptions();
pngOptions.compression = 0; // compression value: 0-9
pngOptions.interlaced = false;
// Set the file processing counter
var counter = 0;
// Perform the processing and saving
for (var i = 0; i < list1.length; i++) {
open(list1[i]);
var doc2 = open(list2[i]);
var docName = doc2.name.replace(/\.[^\.]+$/, '.png');
matchColor(100, 100, 0, true);
doc2.saveAs(new File(saveFolder + '/' + docName), pngOptions);
counter++;
while (app.documents.length > 0) {
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
}
// End of script
app.displayDialogs = savedDisplayDialogs;
app.beep();
alert('Script completed!' + '\r' + counter + ' output files of ' + list1.length + ' input file pairs saved to:' + '\r' + saveFolder.fsName);
} catch (err) {
while (app.documents.length > 0) {
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
alert(err);
}
} else {
alert('Please close all open documents before running this script!');
}
function matchColor(lightness, colorRange, fade, selection) {
var sourceDoc = app.documents[0].name; // [0] - the first doc open
function s2t(s) {
return app.stringIDToTypeID(s);
}
var descriptor = new ActionDescriptor();
var reference = new ActionReference();
descriptor.putInteger(s2t("lightness"), lightness);
descriptor.putInteger(s2t("colorRange"), colorRange);
descriptor.putInteger(s2t("fade"), fade);
descriptor.putBoolean(s2t("selection"), selection);
reference.putProperty(s2t("layer"), s2t("background"));
reference.putName(s2t("document"), sourceDoc); // variable for source doc name
descriptor.putReference(s2t("source"), reference);
executeAction(s2t("matchColor"), descriptor, DialogModes.NO);
}
}());
- Copy the code text to the clipboard
- Open a new blank file in a plain-text editor (not in a word processor)
- Paste the code in
- Save as a plain text format file – .txt
- Rename the saved file extension from .txt to .jsx
- Install or browse to the .jsx file to run (see below)
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html#Photoshop