🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.photoshop.scripting
4 messages
4 total messages Started by arkside Mon, 30 Mar 2009 09:43
Saving layer comps as .png with custom filenames
#34
Author: arkside
Date: Mon, 30 Mar 2009 09:43
10 lines
992 bytes
I'm using an action to create 30 layercomps from my .psd.

I need to save those out as .png files with a filename like this...

DocName_E00_S01.png

So "DocName" is the existing filename, "E" always stays the same, "00" is a 2 digit serial number that matches the name of the layercomp, and "S01" is text that I enter for the entire set of layercomps.

I've tried so many ways to solve this, but I'm a total js newbie.
Can anyone help?
Re: Saving layer comps as .png with custom filenames
#35
Author: try67
Date: Mon, 30 Mar 2009 10:27
1 lines
655 bytes
Which part can't you do? Do you know how to export as PNG?
Re: Saving layer comps as .png with custom filenames
#38
Author: christoph_pfaffenbichler
Date: Mon, 30 Mar 2009 13:33
53 lines
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; 

   };
Re: Saving layer comps as .png with custom filenames
#41
Author: arkside
Date: Mon, 30 Mar 2009 19:09
10 lines
1139 bytes
Try67, I found a script hack of the layercomps to files script to get the png. instead of the other file types included in the default script.
But I need both specifically a png, and filename script.

It seems if I start this script by defining the png options, then adjust the end of the script to save as png, it would work.

Christopher, I really appreciate the syntax you've updated to fix my name.

I'll try my hand at the png portion and upload it when/if I get it working.

xBytor thanks for the original syntax.
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