Mobile app version of vmapp.org
Login or Join
Pierce403

: Photoshop export layers to png but with specific background layer I have a psd with ~400 Layers which contain semitransparent images and one layer with a solid color. I want to export those

@Pierce403

Posted in: #AdobePhotoshop #Export #Png

I have a psd with ~400 Layers which contain semitransparent images and one layer with a solid color. I want to export those layers to png8 and want that layers to have that solid background. I can export those layers with File->Scripts->Export layers to files, but cannot provide the background option. Any simple way to achieve this?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Pierce403

1 Comments

Sorted by latest first Latest Oldest Best

 

@Phylliss782

I've found a solution. After searching quite a bit, I finally found an answer. I wrote a little jpx script, though output is now as jpg.

// variables
var destination = "C:/Users/...../"
var doc = app.activeDocument;
var artlayers = new Array();

// jpeg options
var options = new ExportOptionsSaveForWeb();
options.quality = 80;
options.format = SaveDocumentType.JPEG;

// loop through all layers
var x = 0;
var a = 0;
while (x < doc.layers.length) {
// check if the layer is a item
if (doc.layers[x].kind == LayerKind.NORMAL) {
// add to array
artlayers[a] = x;
a++;
}
x++;
}

var x = 0;
var a = 0;

for (x=0; x < artlayers.length; x++)

{
doc.layers[artlayers[x]].visible = true;
// export as jpeg
try { doc.backgroundLayer.visible = true; } catch (e) {}
file = new File(destination + doc.layers[artlayers[x]].name +".jpg");
doc.exportDocument(file, ExportType.SAVEFORWEB, options);
doc.layers[artlayers[x]].visible = false;
}


It's important to know, that the background-layer must be an original photoshop background. If the name of the bg-layer is in italics, you're good to go. also, all layers except the bg-layer have to be invisible/deselected.

have fun! :)

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme