Copy link to clipboard
Copied
Hi – I have multiple layers in multiple .psd document that need to be exported out as PNG 300pdi, sRGB, layers. (The PNG files need to retain these qualities). These are being used by an intergrated 3rd party variable printer that needs the transparent quality of PNG, they are then converted to PDFs and printed. I understand PNGs aren't made for print, but these are my requirements. Any help would be much appreciated. Thanks.
Copy link to clipboard
Copied
You'll need to save, not export with your stated requirements. Presuming that the source files are sRGB and 300ppi, see how this script works for you:
/*
All top level layers saved to PNG.jsx
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-do-i-export-layers-as-png-without-loosing-the-size-and-placement-of-the-particular-layer/m-p/12734226
Stephen Marsh, 5th February 2022 - v1.0
Based on:
https://damienfremont.com/2019/05/25/how-to-photoshop-script-export-layers-to-png-files/
Note: Existing files will be overwritten!
*/
#target photoshop
try {
// Save new files next to the original files
var outputPath = app.activeDocument.path.fsName;
} catch (e) {
// Unsaved files to desktop
var outputPath = "~/Desktop";
}
for (var i = 0; i < app.activeDocument.layers.length; i++) {
for (var j = 0; j < app.activeDocument.layers.length; j++) {
app.activeDocument.layers[j].visible = false;
}
var layerIndex = i;
app.activeDocument.layers[layerIndex].visible = true;
var layerName = app.activeDocument.layers[layerIndex].name.replace(/[^a-z0-9 _-]/gi, '').replace(/ +|-+|_+$/g, '');
var filename = app.activeDocument.name.replace(/\.[^\.]+$/, '');
var file = new File(outputPath + "/" + filename + "_" + layerName + ".png");
var saveOptions = new PNGSaveOptions();
saveOptions.compression = 0; // 0-9
saveOptions.interlaced = false;
app.activeDocument.saveAs(file, saveOptions, true, Extension.LOWERCASE);
}
You can record the script into an action and then use the Batch command with a destination of none.
Quickstart:
Copy link to clipboard
Copied
@Holmes24 – Let me know how you go with the script.