Article View: adobe.photoshop.scripting
Article #38Re: Saving layer comps as .png with custom filenames
From: christoph_pfaffenbichler
Date: Mon, 30 Mar 2009 13:33
Date: Mon, 30 Mar 2009 13:33
53 lines
1803 bytes
1803 bytes
If it is about the way in which to write the documentname and -path this might help, I didn�t bother to change it to png though:
// for getting tiffs of layercomps;
#target photoshop
var myDocument = app.activeDocument;
// getting the name and location, thanks to xbytor;
var basename = myDocument.name.match(/(.*)\.[^\.]+$/)[1];
var docPath = myDocument.path;
// tiff options;
tifOpts = new TiffSaveOptions();
tifOpts.embedColorProfile = true;
tifOpts.imageCompression = TIFFEncoding.TIFFLZW;
tifOpts.alphaChannels = false;
tifOpts.byteOrder = ByteOrder.MACOS ;
tifOpts.layers = true;
// create the versions;
for (var m = 0; m < myDocument.layerComps.length; m++) {
// apply the layer comp;
myDocument.layerComps[m].apply();
var theLayerCompName = myDocument.layerComps[m].name;
// duplicate the image;
var thecopy = myDocument.duplicate (thecopy, true);
// save the tiff;
thecopy.saveAs((new File(docPath+"/"+basename+"_E"+theLayerCompName+"_S01.tif")),tifOpts,true);
thecopy.close(SaveOptions.DONOTSAVECHANGES);
app.activeDocument = myDocument;
};
Technical Details
Message-ID:
<59b872e4.1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossingReferences:
<59b872e4.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f5839,2998c71da96e2d93 X-Google-Attributes: gidf5839,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII From: christoph_pfaffenbichler@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.photoshop.scripting Subject: Re: Saving layer comps as .png with custom filenames Message-ID: <59b872e4.1@webcrossing.la2eafNXanI> Date: Mon, 30 Mar 2009 06:33:01 -0700 References: <59b872e4.-1@webcrossing.la2eafNXanI> Lines: 31 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit