🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.photoshop.scripting
Article #384

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

#384
From: fsonline_noob
Date: Mon, 02 Mar 2009 22:38
37 lines
2007 bytes
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++
}
=============================================
Technical Details
Message-ID: <59b81817.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!newshub.sdsu.edu!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: f5839,60c9792bef181729,start
X-Google-Attributes: gidf5839,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: fsonline_noob@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.photoshop.scripting
Subject: Batch Export Separate Layer with the same
 Background Layer , Please HELP
Message-ID: <59b81817.-1@webcrossing.la2eafNXanI>
Date: Mon, 2 Mar 2009 14:38:24 -0800
Lines: 8
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit