🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.photoshop.scripting
2 messages
2 total messages Started by Ken_Kelleher Sat, 21 Mar 2009 22:46
Scripts / Export Layers to Files / Include Background Layer
#228
Author: Ken_Kelleher
Date: Sat, 21 Mar 2009 22:46
6 lines
814 bytes
Running the script Export Layers to files.
Need to keep one layer on that is applied to all the layers (I have a stroke on the top layer I would like applied to all the images that are saved out.)

How do I modify the script for this?
Thanks!
Ken
Re: Scripts / Export Layers to Files / Include Background Layer
#229
Author: christoph_pfaffenbichler
Date: Sun, 22 Mar 2009 12:21
103 lines
2753 bytes
Adapting that Script might be somewhat difficult as it is pretty bulky.
But if it�s always the topmost layer that�s supposed to stay visible and You know which format You want to save the resulting files to beforehand something much smaller may suffice.
You might try this:


 
#target photoshop; 

var myDocument = app.activeDocument; 

// get the name and location; 

var docName = myDocument.name; 

var basename = docName.match(/(.*)\.[^\.]+$/)[1]; 

var docPath = myDocument.path; 

// get the artlayers and remove the topmost; 

var allArtLayers = collectLayers(myDocument); 

var theTopmost = allArtLayers.pop(); 

// hide all but the topmost layer; 

for (var n = 0; n < allArtLayers.length; n++ ) { 

   allArtLayers[n].visible = false 

   }; 

for (var m = 0; m < allArtLayers.length; m++ ) { 

// show the layer; 

   allArtLayers[m].visible = true; 

// tiff options; 

   tifOpts = new TiffSaveOptions(); 

   tifOpts.embedColorProfile = true; 

   tifOpts.imageCompression = TIFFEncoding.TIFFLZW; 

   tifOpts.alphaChannels = false; 

   tifOpts.byteOrder = ByteOrder.MACOS ; 

   tifOpts.layers = true; 

// duplicate the image; 

   var thecopy = myDocument.duplicate (thecopy, true); 

// save copy; 

   thecopy.saveAs((new File(docPath+"/"+basename+" "+allArtLayers[m].name+".tif")),tifOpts,true); 

   thecopy.close(SaveOptions.DONOTSAVECHANGES); 

// hide the layer again; 

   allArtLayers[m].visible = false 

//that�s it; thanks to xbytor; 

   }; 

////// collect all artlayers ////// 

function collectLayers (theParent) { 

   if (!allArtLayers) { 

      var allArtLayers = new Array}  

   else {}; 

   for (var m = theParent.layers.length - 1; m >= 0;m--) { 

      var theLayer = theParent.layers[m]; 

// apply the funtion to layersets; 

      if (theLayer.constructor == ArtLayer) { 

         allArtLayers = allArtLayers.concat(theLayer) 

         } 

      else { 

         allArtLayers = allArtLayers.concat(collectLayers(theLayer)) 

         } 

      }; 

   return allArtLayers 

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