Thread View: adobe.photoshop.scripting
8 messages
8 total messages
Started by fsonline_noob
Mon, 02 Mar 2009 22:38
Batch Export Separate Layer with the same Background Layer , Please HELP
Author: fsonline_noob
Date: Mon, 02 Mar 2009 22:38
Date: Mon, 02 Mar 2009 22:38
37 lines
2007 bytes
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++
}
=============================================
Re: Batch Export Separate Layer with the same Background Layer , Please HELP
Author: xbytor
Date: Mon, 02 Mar 2009 23:04
Date: Mon, 02 Mar 2009 23:04
8 lines
934 bytes
934 bytes
> Please help: I'd like all images exported has separate layer AND the same background.
Add this just before the exportDocument line:
try { doc.backgroundLayer.visible = true; } catch (e) {}
-X
Re: Batch Export Separate Layer with the same Background Layer , Please HELP
Author: fsonline_noob
Date: Tue, 03 Mar 2009 13:49
Date: Tue, 03 Mar 2009 13:49
1 lines
715 bytes
715 bytes
WOW, It really works. Thank you very much, you are pro. :D
Re: Batch Export Separate Layer with the same Background Layer , Please HELP
Author: fsonline_noob
Date: Tue, 03 Mar 2009 16:02
Date: Tue, 03 Mar 2009 16:02
1 lines
711 bytes
711 bytes
Any idea if I 'd like to save them as "layer name.jpg"
Re: Batch Export Separate Layer with the same Background Layer , Please HELP
Author: christoph_pfaffenbichler
Date: Fri, 06 Mar 2009 09:26
Date: Fri, 06 Mar 2009 09:26
3 lines
839 bytes
839 bytes
Maybe:
doc.exportDocument(new File("/c/"+ doc.layers[artlayers[x]].name +".jpg"), ExportType.SAVEFORWEB, options)
?
Re: Batch Export Separate Layer with the same Background Layer , Please HELP
Author: Ken_Kelleher
Date: Sat, 21 Mar 2009 20:41
Date: Sat, 21 Mar 2009 20:41
10 lines
1069 bytes
1069 bytes
Hey Guys, Where do I save this and how do I run it? I tried saving it as a jsx file and running it by going to File / Scripts / Browse Didn't work. Bascially trying to export all my layers to files, and keep my top layer applied when the jpegs are saved out-- which will be a border on all the layers below it Any help is appreciated. Thanks! Ken
Re: Batch Export Separate Layer with the same Background Layer , Please HELP
Author: jan_sharrow
Date: Thu, 02 Apr 2009 16:43
Date: Thu, 02 Apr 2009 16:43
1 lines
792 bytes
792 bytes
I would like to use this script, but instead of separate layers, I'd like to save separate groups as files (jpg) and keep the background.
Re: Batch Export Separate Layer with the same Background Layer , Please HELP
Author: Nikki_Sab
Date: Thu, 02 Apr 2009 19:21
Date: Thu, 02 Apr 2009 19:21
1 lines
884 bytes
884 bytes
Would I be able to use this script to export a layer then combined it with the background layer without having to do it manually for each layer, then save each layer into a PDF?
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads