Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

Batch Export Separate Layer with the same Background Layer , Please HELP

$
0
0
I have the code as below, it worked in order saving separate layer to JPG, but it didn't include a Background layer to the JPGs which were exported.

Please help: I'd like all images exported has separate layer AND the same background.

Thanks in advanced.

============================================
// define your variables
var doc = app.activeDocument;
var artlayers = new Array();

// define your jpeg options
var options = new ExportOptionsSaveForWeb();
options.quality = 80; // Start with highest quality (biggest file).
options.format = SaveDocumentType.JPEG; // Or it'll default to GIF.

// 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++;
}

// loop through our array of layers
// each loop will export a jpeg with 1 text layer visible and hiding the others
var x = 0;
var a = 0;
while (a < artlayers.length)
{
while (x < artlayers.length)
{
if (a == artlayers[x])
{
doc.layers[artlayers[x]].visible = true;
} else {
doc.layers[artlayers[x]].visible = false;
}

x++;
}

// export as jpeg
doc.exportDocument(new File("/c/variation_"+ a +".jpg"), ExportType.SAVEFORWEB, options)

x = 0;
a++
}
=============================================

Viewing all articles
Browse latest Browse all 12244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>