
Stephen Marsh
Community Expert
Stephen Marsh
Community Expert
Activity
23m ago
Apart from using Adobe Bridge or another browser to eyeball the results, it's possible to script this to various degrees. The following script will check selected files for a strip of black pixels and write the suspect file names and paths to a text file on the desktop. For processing speed, it will make a temporary crop of the canvas width to 3px wide before checking the histogram, which may not always be perfect and could possibly lead to some false-positives being reported.
/*
Log Files With Black Full Width Line to Text File Fast.jsx
Stephen Marsh
v1.0 - 7th March 2025
https://community.adobe.com/t5/photoshop-ecosystem-discussions/black-horizontal-line-across-the-image-after-save-to-tif/m-p/15195817
Note: It is assumed that the documents are RGB mode
*/
#target photoshop
// Open dialog to select files
var theFiles = File.openDialog("Select files to check for full width 0r0g0b pixels", true);
if (theFiles) {
processFiles(theFiles);
} else {
alert("No files selected.");
}
// Function to check histogram for 0r0g0b
function checkHistogramForBlack(doc) {
var histo = doc.histogram;
return histo[0] > 0;
}
// Function to process files
function processFiles(theFiles) {
var resultFile = new File(Folder.desktop + "/BlackPixelsCheckResults.txt");
resultFile.open("w");
resultFile.writeln("Files possibly containing full width 0r0g0b pixels:\n");
// Counter for files with 0r0g0b pixels
var blackFilesCount = 0;
// Loop through files
for (var i = 0; i < theFiles.length; i++) {
var theFile = theFiles[i];
var doc = app.open(theFile);
// Resize canvas to 3px wide, yes it's a hack but it works much faster than looping through all pixels...
// Some edge cases could be falsely logged, but it's probably good enough for most cases!
doc.resizeCanvas(UnitValue(3, "px"), doc.height, AnchorPosition.MIDDLECENTER);
if (checkHistogramForBlack(doc)) {
resultFile.writeln(theFile.fsName);
blackFilesCount++; // Increment counter when 0r0g0b pixels are found
}
doc.close(SaveOptions.DONOTSAVECHANGES);
}
// End of script notification
resultFile.close();
alert("Processing complete!\n" + "Total files checked: " + theFiles.length + "\n" +
"Files with possible full width black pixels: " + blackFilesCount + "\n" +
"Results saved to: " + resultFile.fsName);
resultFile.execute();
}
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
... View more
46m ago
Put all your photos into a folder and run adobe bridge, make an export preset of the resolution you need and the format you need. The printer doesnt want them under 1mb, he wants them at least 1mb (ideally, not a requirement). Hes trying to get you the best print you can get - so basically you want to give him high resolution images and you can make them all the proper resolution you need with adobe bridge
... View more
4 hours ago
does anyone know what charIDToTypeID( "LwCs" ) and charIDToTypeID( "DocI" ) refere to in terms of actions or gui?
By @gerardoc50494125
If TypeID codes are the same as StringID codes, then:
charIDToTypeID( "LwCs" ) = 'lowerCase'
charIDToTypeID( "DocI” ) = 'documentID'
... View more
6 hours ago
So I thought I was having an issue, but then remebered that it wont ask you till you are out saving it... File>Save for the web> Save then what you see in my screen shot.
... View more
8 hours ago
Hi, did you look at the help link and try the script? You install the script as noted and it opens the folder that your active document is inside.
... View more
9 hours ago
Any update on this? Will the user be able to select a color for the border of the selected thumbanil or mask? Makes no sense that the border is black on a layer mask than can be all or mostly the same color. Again it wasn't like this on previous versions of PS (at least on Intel Macs)
... View more
12 hours ago
1 Upvote
were you ever able to resolve this? Everywhere online where this issue comes up, no one has been able to post a solution.
Automatically replacing Smart Object content and saving copies off of the containing file seems to have come up and been addressed again and again …
Maybe it’s not that no one »has been able to post a solution« but that you did not come across those threads.
If you have a specific scenario where you want to automate such a process please provide sample files and outline the output-needs.
... View more
Mar 05, 2025
I do apologize, I had overlooked the psd in the original post.
// 2025, use it at your own risk;
if (app.documents.length > 0) {
if (hasLayerMask () == true) {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID("Chnl"), charIDToTypeID("Chnl"), charIDToTypeID("Msk "));
desc.putReference(charIDToTypeID("null"), ref);
desc.putBoolean(charIDToTypeID("MkVs"), false );
executeAction(charIDToTypeID("slct"), desc, DialogModes.NO );
// load transparency;
var desc5 = new ActionDescriptor();
var ref1 = new ActionReference();
var idchannel = stringIDToTypeID( "channel" );
var idselection = stringIDToTypeID( "selection" );
ref1.putProperty( idchannel, idselection );
desc5.putReference( stringIDToTypeID( "null" ), ref1 );
var ref2 = new ActionReference();
ref2.putEnumerated( idchannel, idchannel, stringIDToTypeID( "transparencyEnum" ) );
desc5.putReference( stringIDToTypeID( "to" ), ref2 );
executeAction( stringIDToTypeID( "set" ), desc5, DialogModes.NO );
// load layer mask;
var desc7 = new ActionDescriptor();
var ref3 = new ActionReference();
ref3.putEnumerated( idchannel, stringIDToTypeID( "ordinal" ), stringIDToTypeID( "targetEnum" ) );
desc7.putReference( stringIDToTypeID( "null" ), ref3 );
var ref4 = new ActionReference();
ref4.putProperty( idchannel, idselection );
desc7.putReference( stringIDToTypeID( "with" ), ref4 );
executeAction( stringIDToTypeID( "interfaceIconFrameDimmed" ), desc7, DialogModes.NO );
// check selection;
try {activeDocument.selection.bounds;
alert ("pixels")
}
catch (e) {alert ("empty")}
}
};
////// has layer mask //////
function hasLayerMask () {
var m_Dsc01, m_Ref01;
m_Ref01 = new ActionReference();
m_Ref01.putEnumerated(stringIDToTypeID("layer"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
m_Dsc01 = executeActionGet(m_Ref01);
return m_Dsc01.hasKey(charIDToTypeID("Usrs"));
};
... View more
Mar 05, 2025
I'm still getting an "object is not safe to edit" error.
By @anthony38519375m1bj
Please share the code and sample files.
... View more
Mar 05, 2025
I think Stephen might be right. Although you don’t need a preview to know that an image is going to be bigger or smaller, a preview can be very practical and useful if you are trying to anticipate whether the details in your 50% enlargement are going to look their best depending on whether you choose Automatic, Preserve Details, Bicubic, or Nearest Neighbor resampling (that isn’t even all the options). And there will certainly be a visual difference between those options.
... View more
Mar 05, 2025
01:04 PM
The file is still there. Dropbox saying "Can’t load this file type" simply means it can't preview it like it would a photo or PDF or something, but you can just click Download at the bottom.
... View more
Mar 05, 2025
09:47 AM
(My "thanks so much..." comment was actually the answer to the comment that is now missing. Not sure why it's now shown as an answer to your comment)
... View more
Mar 05, 2025
08:55 AM
Amazing - I typically have to keep an image's dimensions in place, but will have to increase or decrease the DPI depending on printing requirements. I'll try these scripts and see if they require any modifation for my use case - thank you!
... View more
Community Expert
in Photoshop ecosystem Discussions
Mar 05, 2025
05:51 AM
1 Upvote
Mar 05, 2025
05:51 AM
1 Upvote
@suzy_95
I created the following script to stack alpha-numeric sorting images from two separate folders to a two-layer file. This should get you 90% of the way there. Before the script saves the file to various file formats, an action run by the script can complete any further automation that you require (the action can run another script if more complex processing is required that can't be achieved via an action).
https://community.adobe.com/t5/photoshop-ecosystem-discussions/script-to-open-files-and-layer-them/m-p/12532657#U14933502
... View more
Mar 05, 2025
03:49 AM
1 Upvote
Yeah, even more likely.
... View more
Mar 05, 2025
03:46 AM
Hello, I had the same problem so have used this script and it has worked : https://github.com/Silly-V/Adobe-Illustrator/blob/master/Variable%20Importer/VariableImporter.jsx To use it : In Github : Download as Raw In Illustrator : File > scripts > other scripts > select " VariableImporter.jsx " On the Script's Menu : import the CSV/XML > Options > DataSet Names > select the column that you want I hope that helps
... View more
Mar 05, 2025
03:12 AM
This is one of the most annoying pop-ups in Photoshop ever! I have the latest version [v 26.4.1] andd still it disrupts my work as it pops up suggesting that I should update Photoshop! But when I open the Creative Cloud app and search for updates, it says that there are none andd I have the latest version! Really Adobe? Please fix this immediately.
... View more
Community Expert
in Photoshop ecosystem Discussions
Mar 05, 2025
12:39 AM
1 Upvote
Mar 05, 2025
12:39 AM
1 Upvote
Another option is to just have standard layers with the 3 hats in an upper layer group, then have the base image in a lower group and use this script:
https://github.com/mechanicious/photoshopCompositionComposer
... View more
Mar 04, 2025
01:47 PM
1 Upvote
As designed doesn't necessarily mean it's the right thing for everyone who uses the tool! I manage thousands of assets that are tied to an ID, so the PSD and the exports live in the same directory. Point being, the majority of my use-case is that I need to save JPGs alongside my PSDs. For example – I have a folder that is /SomeProject/0012/ In that folder is my source file, usually /SomeProject/0012/0012-Source.jpg Then, I create my PSD, usually /SomeProject/0012/0012-Main.psd – it does this by default :white_heavy_check_mark: Then when I go to export my PSD to jpg, it takes me to the previous ID I was working in : /SomeProject/0011/0012-Main.jpg Obviously, it is incredibly annoying for me to redirect to my most recent folder so that I can save the export to the right directory : /SomeProject/0012/0012-Main.jpg That said, I ocassionaly dump to a global exports folder so the as-designed behavior is useful in that case : /SomeProject/GlobalExports/ Solution : an option that let's you switch from your app-wide most recent save location vs. your export most recent save location... such as this! When adobe switched from "save for web" to "Export As", it added the following option in settings. Thank god.
... View more
Mar 04, 2025
01:06 PM
I tried to create a script with ChatGPT, but it didn't work. This one does. Thank you so much.
By @marief2223714
Thank you, you're welcome.
... View more
Mar 04, 2025
08:32 AM
Probé esto pero todavía no funciona. Gracias de todos modos.
[PII removed] [Lord Wholesale Co]<> This e-mail and files transmitted are confidential and may be subject to legal professional privilege. It is for the use of the named recipient(s) only. If you have received this e-mail in error, please notify us immediately. Furthermore, you are expressly prohibited from copying or disclosing its contents to any third party, and should delete it from your computer systems immediately. Please note that information sent by e-mail may be intercepted in transmission and may be altered without our knowledge. You are advised to verify any advice given before acting upon it.
... View more
Community Expert
in Photoshop ecosystem Discussions
Mar 04, 2025
01:38 AM
1 Upvote
Mar 04, 2025
01:38 AM
1 Upvote
I have been working on a generic GUI version of the Data Sets to JPEG script, allowing users to select from JPEG, PNG, WEBP, TIFF and PSB output file formats. Although I could have added PSD, this is covered by the native Data Set export functionality.
/*
Photoshop Variables Data Sets to Files GUI v1-0.jsx
v1.0 - 4rd March 2025, Initial Release
Updated and extended by Stephen Marsh, tested with v2019, v2020, v2021, v2024 and v2025 on Mac and Windows.
Original script by Mike Hale, 2010
NOTE: The active document must have Data Sets already defined.
https://community.adobe.com/t5/photoshop-ecosystem-discussions/using-datasets/td-p/2665594
https://forums.adobe.com/thread/628182
https://forums.adobe.com/message/2773935#2773935
*/
#target photoshop
// Adjust the following "user friendly" variables as required. A GUI for these file format options isn't planned!
// Filename suffix separator
var separator = '_'; // '_' | ' ' | '-' (underscore, space or hyphen)
// saveJPEG global variables
var jpegEmbedColorProfile = true; // Boolean: true | false
var jpegFormatOptions = FormatOptions.STANDARDBASELINE; // FormatOptions.STANDARDBASELINE | FormatOptions.OPTIMIZEDBASELINE | FormatOptions.PROGRESSIVE
var jpegMatte = MatteType.NONE; // MatteType.NONE | MatteType.WHITE | MatteType.BLACK
var jpegQuality = 10; // Numeric: 0 - 12 (low quality to highest quality)
// savePNG global variables
var pngCompression = 1; // Numeric: 0 - 9 (low compression to highest)
var pngInterlaced = false; // Boolean: true | false
// saveWebP global variables
var webPCompressionType = "compressionLossy"; // String: "compressionLossless" | "compressionLossy"
var webPCompIsLossless = false; // Boolean: true | false
var webPQuality = 75; // Numeric: 0 - 100 (low quality to highest quality)
var webPIncludeXMPData = true; // Boolean: true | false
var webPIncludeEXIFData = false; // Boolean: true | false
var webPIncludePsExtras = false; // Boolean: true | false
var webPLowerCase = true; // Boolean: true | false
var webPEmbedProfiles = true; // Boolean: true | false
// saveTIFF global variables
var tiffEmbedColorProfile = true; // Boolean: true | false
var tiffByteOrder = ByteOrder.IBM; // ByteOrder.MACOS | ByteOrder.IBM
var tiffTransparency = true; // Boolean: true | false
var tiffLayerCompression = LayerCompression.ZIP; // LayerCompression.RLE | LayerCompression.ZIP
var tiffInterleaveChannels = true; // Boolean: true | false
var tiffAlphaChannels = true; // Boolean: true | false
var tiffAnnotations = true; // Boolean: true | false
var tiffSpotColors = true; // Boolean: true | false
var tiffSaveLayers = true; // Boolean: true | false
var tiffSaveImagePyramid = false; // Boolean: true | false
var tiffImageCompression = TIFFEncoding.TIFFLZW; // TIFFEncoding.NONE | TIFFEncoding.JPEG | TIFFEncoding.TIFFLZW | TIFFEncoding.TIFFZIP
///// GUI FUNCTION /////
try {
var createDialog = function () {
// Confirm with the user that the file meets the criteria
if (!confirm("Data Sets must be created before running this script. Continue?", false)) {
return;
}
// Create the dialog window
var dlg = new Window('dialog', 'Data Sets to Files (v1.0)');
dlg.preferredSize = [500, 350];
// Create main panel to hold input controls
dlg.mainPanel = dlg.add('panel', undefined, '');
dlg.mainPanel.alignment = ['fill', 'fill'];
dlg.mainPanel.margins = [15, 15, 15, 15];
dlg.mainPanel.spacing = 10;
dlg.mainPanel.alignChildren = 'left';
// CSV File button and path
var csvGroup = dlg.mainPanel.add('group');
csvGroup.orientation = 'column';
csvGroup.alignChildren = 'fill';
csvGroup.alignment = ['fill', 'top'];
csvGroup.add('statictext', undefined, 'Select the Data Set .csv file to import:');
var csvBtnGroup = csvGroup.add('group');
csvBtnGroup.alignment = ['fill', 'top'];
csvBtnGroup.alignChildren = 'left';
dlg.mainPanel.csvFileBtn = csvBtnGroup.add('button', undefined, 'Browse...', { name: 'browse' });
dlg.mainPanel.csvFileBtn.preferredSize.width = 100;
// Add a panel for the CSV file path
var csvPathPanel = csvGroup.add('panel');
csvPathPanel.alignment = ['fill', 'top'];
csvPathPanel.margins = 10;
dlg.mainPanel.csvFilePath = csvPathPanel.add('statictext', undefined, 'No file selected', { truncate: "middle" });
dlg.mainPanel.csvFilePath.alignment = ['fill', 'top'];
dlg.mainPanel.csvFilePath.minimumSize.width = 350;
// Output Folder button and path
var outputGroup = dlg.mainPanel.add('group');
outputGroup.orientation = 'column';
outputGroup.alignChildren = 'fill';
outputGroup.alignment = ['fill', 'top'];
outputGroup.add('statictext', undefined, 'Select the output folder:');
var outputBtnGroup = outputGroup.add('group');
outputBtnGroup.alignment = ['fill', 'top'];
outputBtnGroup.alignChildren = 'left';
dlg.mainPanel.outputFolderBtn = outputBtnGroup.add('button', undefined, 'Browse...', { name: 'browse' });
dlg.mainPanel.outputFolderBtn.preferredSize.width = 100;
// Add a panel for the output folder path
var outputPathPanel = outputGroup.add('panel');
outputPathPanel.alignment = ['fill', 'top'];
outputPathPanel.margins = 10;
dlg.mainPanel.outputFolderPath = outputPathPanel.add('statictext', undefined, 'No folder selected', { truncate: "middle" });
dlg.mainPanel.outputFolderPath.alignment = ['fill', 'top'];
dlg.mainPanel.outputFolderPath.minimumSize.width = 350;
// File Format Group
var formatGroup = dlg.mainPanel.add('group');
formatGroup.orientation = 'column';
formatGroup.alignChildren = 'left';
formatGroup.alignment = ['left', 'top'];
// Add a static text label
formatGroup.add('statictext', undefined, 'Select the output file format:');
// Add a group for the dropdown and description
var formatDropdownGroup = formatGroup.add('group');
formatDropdownGroup.orientation = 'row';
formatDropdownGroup.alignChildren = 'left';
// Create the conditional dropdown options array based on Photoshop version 2022 check/test
var formatOptions = ["JPEG", "PNG", "TIFF", "PSB"];
if (parseFloat(app.version) >= 23) {
formatOptions.splice(2, 0, "WEBP"); // Insert into the array at index 2 (3rd position)
}
// Add a dropdown list for format selection using the conditional format options
dlg.mainPanel.formatList = formatDropdownGroup.add('dropdownlist', undefined, formatOptions);
// Default selection to the first entry (JPEG)
dlg.mainPanel.formatList.selection = 0;
// Set the preferred width for the dropdown list
dlg.mainPanel.formatList.preferredSize.width = 70;
// Add a static text label that updates with format selection
dlg.mainPanel.formatDescription = formatDropdownGroup.add('statictext', undefined, '(' + jpegFormatOptions.toString().replace(/FormatOptions\./, '') + ' Format Option, Quality ' + jpegQuality + ')');
// Add a static text label for filename suffix options
formatGroup.add('statictext', undefined, 'Select the filename suffix:');
// Add a dropdown list for filename suffix options
dlg.mainPanel.suffixList = formatGroup.add('dropdownlist', undefined, ['First Column in CSV', 'Dataset Index No.']);
// Default selection to 'First column in CSV'
dlg.mainPanel.suffixList.selection = 0;
// Set the preferred width for the suffix dropdown list
dlg.mainPanel.suffixList.preferredSize.width = 160;
// Create button group for Cancel and OK buttons
var buttonGroup = dlg.add('group');
buttonGroup.orientation = 'row';
buttonGroup.alignment = 'right';
buttonGroup.spacing = 5;
dlg.cancelBtn = buttonGroup.add('button', undefined, 'Cancel', { name: 'cancel' });
dlg.okBtn = buttonGroup.add('button', undefined, 'OK', { name: 'ok' });
// Update the static text when the dropdown selection changes
dlg.mainPanel.formatList.onChange = function () {
var selectedFormat = dlg.mainPanel.formatList.selection.text;
var descriptions = {
'JPEG': '(' + jpegFormatOptions.toString().replace(/FormatOptions\./, '') + ' Format Option, Quality ' + jpegQuality + ')',
'PNG': '(Lossless Compression ' + pngCompression + ', Supports Transparency)',
'WEBP': '(Lossy Compression ' + webPQuality + ', Supports Transparency)',
'TIFF': '(' + tiffByteOrder.toString().replace(/ByteOrder\./, '') + ' Byte Order, ' + tiffImageCompression.toString().replace(/TIFFEncoding\./, '') + ' Compression)',
'PSB': '(Large Document Format)'
};
dlg.mainPanel.formatDescription.text = descriptions[selectedFormat];
};
// Return the dialog
return dlg;
};
} catch (error) {
alert(error + ', Line: ' + error.line);
}
///// HELPER FUNCTIONS /////
function fileImportDataSets(file) {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putClass(stringIDToTypeID("dataSetClass"));
desc.putReference(charIDToTypeID("null"), ref);
desc.putPath(charIDToTypeID("Usng"), new File(file));
desc.putEnumerated(charIDToTypeID("Encd"), stringIDToTypeID("dataSetEncoding"), stringIDToTypeID("dataSetEncodingAuto"));
desc.putBoolean(stringIDToTypeID("eraseAll"), true);
desc.putBoolean(stringIDToTypeID("useFirstColumn"), true);
executeAction(stringIDToTypeID("importDataSets"), desc, DialogModes.NO);
};
function applyDataSet(setName) {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var reference = new ActionReference();
reference.putName(s2t("dataSetClass"), setName);
descriptor.putReference(s2t("null"), reference);
executeAction(s2t("apply"), descriptor, DialogModes.NO);
};
function getDataSetNames(csvFileRef) {
var _ftn = function (string) {
var csvItems = string.split(",");
var datasetName = csvItems[0].replace(/(^['\"]|['\"]$)/g, ''); // Clean both single and double quote-escaped values
return datasetName;
};
csvFileRef.open();
var datasetArray = [];
var i = 0;
var csvString;
while (!csvFileRef.eof) {
csvString = csvFileRef.readln();
// Skip empty lines
if (csvString.length < 2) continue;
datasetArray[i] = _ftn(csvString);
i++;
}
csvFileRef.close();
return datasetArray;
};
function paddedSetNo(number) {
var str = number.toString();
// 4-digit padding (e.g., 1 = 0001, 23 = 0023)
while (str.length < 4) {
str = "0" + str;
}
return str;
}
function jpegSaveOptions() {
var jpgOptions = new JPEGSaveOptions();
jpgOptions.formatOptions = jpegFormatOptions;
jpgOptions.embedColorProfile = jpegEmbedColorProfile;
jpgOptions.matte = jpegMatte;
jpgOptions.quality = jpegQuality;
return jpgOptions;
};
function pngSaveOptions() {
var pngOptions = new PNGSaveOptions();
pngOptions.compression = pngCompression;
pngOptions.interlaced = pngInterlaced;
return pngOptions;
};
function saveWebP(saveFile) {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
descriptor2.putEnumerated(s2t("compression"), s2t("WebPCompression"), s2t(webPCompressionType));
if (webPCompIsLossless == false) {
descriptor2.putInteger(s2t("quality"), webPQuality);
}
// Metadata options
descriptor2.putBoolean(s2t("includeXMPData"), webPIncludeXMPData);
descriptor2.putBoolean(s2t("includeEXIFData"), webPIncludeEXIFData);
descriptor2.putBoolean(s2t("includePsExtras"), webPIncludePsExtras);
// WebP format and save path
descriptor.putObject(s2t("as"), s2t("WebPFormat"), descriptor2);
descriptor.putPath(s2t("in"), saveFile);
// The extension
descriptor.putBoolean(s2t("lowerCase"), webPLowerCase);
// Embed color profile
descriptor.putBoolean(s2t("embedProfiles"), webPEmbedProfiles);
// Execute the save
executeAction(s2t("save"), descriptor, DialogModes.NO);
}
function saveTIFF(saveFile) {
var tiffSaveOptions = new TiffSaveOptions();
tiffSaveOptions.embedColorProfile = tiffEmbedColorProfile;
tiffSaveOptions.byteOrder = tiffByteOrder;
tiffSaveOptions.transparency = tiffTransparency;
tiffSaveOptions.layers = tiffSaveLayers;
tiffSaveOptions.layerCompression = tiffLayerCompression;
tiffSaveOptions.interleaveChannels = tiffInterleaveChannels;
tiffSaveOptions.alphaChannels = tiffAlphaChannels;
tiffSaveOptions.annotations = tiffAnnotations;
tiffSaveOptions.spotColors = tiffSpotColors;
tiffSaveOptions.saveImagePyramid = tiffSaveImagePyramid;
tiffSaveOptions.imageCompression = tiffImageCompression;
// Execute the save
app.activeDocument.saveAs(saveFile, tiffSaveOptions, true, Extension.LOWERCASE);
}
function savePSB(saveFile) {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
descriptor2.putBoolean(s2t("maximizeCompatibility"), true);
descriptor.putObject(s2t("as"), s2t("largeDocumentFormat"), descriptor2);
descriptor.putPath(s2t("in"), saveFile);
descriptor.putBoolean(s2t("lowerCase"), true);
descriptor.putBoolean(s2t("layers"), true);
// Execute the save
executeAction(s2t("save"), descriptor, DialogModes.NO);
}
///// MAIN SCRIPT EXECUTION /////
try {
if (app.documents.length > 0) {
var dlg = createDialog();
// CSV selection button
dlg.mainPanel.csvFileBtn.onClick = function () {
var csvFileRef = File.openDialog("Select CSV file:");
if (csvFileRef !== null) {
dlg.mainPanel.csvFilePath.text = csvFileRef.fsName;
}
};
// Output folder selection button
dlg.mainPanel.outputFolderBtn.onClick = function () {
var saveFolder = Folder.selectDialog("Select the output folder to save the files to:");
if (saveFolder !== null) {
dlg.mainPanel.outputFolderPath.text = saveFolder.fsName;
}
};
// Generate the dialog
if (dlg.show() === 1) {
// File and folder variables
var csvFileRef = new File(dlg.mainPanel.csvFilePath.text);
var saveFolder = new Folder(dlg.mainPanel.outputFolderPath.text);
var selectedFormat = dlg.mainPanel.formatList.selection.text;
var selectedSuffixOption = dlg.mainPanel.suffixList.selection.index;
// Import the data sets from the CSV file
fileImportDataSets(csvFileRef);
// Variables for the loop
var datasetNames = getDataSetNames(csvFileRef);
var fileCounter = 0;
var originalDocName = app.activeDocument.name.replace(/\.[^\.]+$/, ''); // Capture the base name once
// Loop through the dataset names and save each file
for (var i = 1; i < datasetNames.length; i++) {
applyDataSet(datasetNames[i]);
// Define suffix based on selection
var suffix = '';
// First column in CSV
if (selectedSuffixOption === 0) {
suffix = getDataSetNames(csvFileRef)[i].replace(/.*\//, '').replace(/\.[^\.]+$/, '');
// 4-digit padded set number
} else if (selectedSuffixOption === 1) {
suffix = paddedSetNo(i);
}
// Construct the filename
var fileName = originalDocName + separator + suffix;
var extension = '';
if (selectedFormat === 'JPEG') {
extension = '.jpg';
} else if (selectedFormat === 'PNG') {
extension = '.png';
} else if (selectedFormat === 'WEBP') {
extension = '.webp';
} else if (selectedFormat === 'TIFF') {
extension = '.tif';
} else if (selectedFormat === 'PSB') {
extension = '.psb';
}
// Save folder and file name
var saveFile = new File(saveFolder + "/" + fileName + extension);
// Save the file with the selected format
if (selectedFormat === 'JPEG') {
app.activeDocument.saveAs(saveFile, jpegSaveOptions(), true, Extension.LOWERCASE);
} else if (selectedFormat === 'PNG') {
app.activeDocument.saveAs(saveFile, pngSaveOptions(), true, Extension.LOWERCASE);
} else if (selectedFormat === 'WEBP') {
saveWebP(saveFile);
} else if (selectedFormat === 'TIFF') {
saveTIFF(saveFile);
} else if (selectedFormat === 'PSB') {
savePSB(saveFile);
}
// Increment the file counter
fileCounter++;
}
// End of script
app.beep();
alert(fileCounter + " " + selectedFormat + " files have been saved to:" + "\n" + saveFolder.fsName);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
} else {
alert('A template file must be open before running this script...');
}
} catch (error) {
alert(error + ', Line: ' + error.line);
}
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
... View more
Community Expert
in Photoshop ecosystem Discussions
Mar 04, 2025
12:33 AM
1 Upvote
Mar 04, 2025
12:33 AM
1 Upvote
The text file encoding may not be correct for images using non-standard characters.
Can you upload the .csv file? You might need to rename it .txt for the forum software.
... View more
Mar 04, 2025
12:29 AM
Actions have always worked this way, you would need a script to store and retrieve a folder path for saving.
... View more
Community Expert
in Photoshop ecosystem Discussions
Mar 04, 2025
12:15 AM
2 Upvotes
Mar 04, 2025
12:15 AM
2 Upvotes
@Bojan Živković - As far as I know, actions record the specific mask details for that individual image, so scripting this has the same limitations.
Actions are the "old school" way of batch processing inside Photoshop. The Camera Raw filter isn't always going to play nicely with Actions or scripts.
@Mike35315067k4t9 - Do this outside of Photoshop, directly in the Adobe Camera Raw plugin on RGB JPEG/TIFF files, where a preset using AI masks works correctly when batch processing the applied settings from one image to all selected images in the filmstrip. If one has Lightroom then that's another option.
... View more
Mar 03, 2025
11:23 PM
When you are sending data to Adobe servers (for Firefly-processing) that is data on Adobe servers, so guess what? Adobe has to try to make sure they are not involved in illegal activities and therefore needs to check.
That the check is extremely »sensitive« is another issue and hopefully it will be addressed sometime, but who knows?
Did you not figure out a work-around (cover up the person/s in the image with a Solid Color Layer temporarily for example before expanding)?
... View more
Mar 03, 2025
01:04 PM
Hello again Stephen, Thanks again for your imput. I have noticed that occasionally the crop as a recorded action will work as expected when using the newest versions of photoshop but, sadly, when they are continually used they will fail again. Please keep in mind that I use the crop command as a recorded action on countless images in my workflow. Failure is simply not an option for many reasons but mostly because of efficiency. My work around as I have mentioned in other responses is to simply install version 25.11. This version runs as expected. What happens, though, is I open photoshop to begin a session and run the command just to find the crop handles missing. What has happened is Creative Cloud has updated without my permission. The fix is to revert to 25.11 and begin the session again. One concern I have is that reverting to 25.11 may become unavailable. So, as I've worked I have considered what my work around might become. I beleive the only solution under that circumstance will be to remove the crop command from the action and crop manually before running the other commands included in my current action. Not my first choice but can be done. I appologise that I seem to be unmovable regarding this specific problem but missing crop handles and sluggish response is unacceptable when it works in one version and not another. Thanks again, Marc
... View more
Mar 03, 2025
10:03 AM
1 Upvote
My pleasure!
... View more
Mar 03, 2025
09:39 AM
Thank you! I couldn't figure out how to create Temp folder, so I saved the file to the USB flash drive and pulled it out. If you use USB a lot, I think you can change the Letter of the drive to Z for example, create action and then get back to default letter.
... View more