• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Export multiple PNG layers from a psd doc retaining original artwork size and colour – sRGB, 300dpi

Explorer ,
Feb 22, 2022 Feb 22, 2022

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.

TOPICS
macOS

Views

156

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Feb 23, 2022 Feb 23, 2022

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:

  1. Copy the code text to the clipboard
  2. Open a new blank file in a plain-text editor (not word-processor)
  3. Paste the code in
  4. Save the text file as .txt
  5. Rename the file extension from .txt to .jsx
  6. Install or browse to the .jsx file to run

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 23, 2022 Feb 23, 2022

Copy link to clipboard

Copied

LATEST

@Holmes24 – Let me know how you go with the script. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines