28
Oct
2004

Photoshop Scripting Plugin Saved my Day

http://www.adobe.com/support/downloads/detail.jsp?ftpID=1536

very recomandable

here is an example exporting Layers into Gifs:
(like you would need it, if you capture a lot of screenshots into layers)

// loop through the document and set each layer's visibility to false
for(var i=0; i<activeDocument.layers.length; i++) {
     // if it's a layer set, loop through it too
     if(activeDocument.layers[i].layers) {
          for(var j=0; j<activeDocument.layers[i].artLayers.length; j++) {
               activeDocument.layers[i].artLayers[j].visible = 0;
               }
          }
     // otherwise just set its visibility
     else {
          activeDocument.layers[i].visible = 0;
          }
     }

// loop through the document and set each layer's visibility to visible
// save it as a gif
// set its visibility back to false
for(var i=0; i<activeDocument.layers.length; i++) {
     activeDocument.layers[i].visible = 1;
     
     // it's not a layer set
     if(!activeDocument.layers[i].layers) {

          // set its name to layer name in a directory called "temp"
          // in the same location as the script

          gifFile = new File( "temp/"+activeDocument.layers[i].name+".gif" );
          gifSaveOptions = new GIFSaveOptions();
          gifSaveOptions.colors = 256;
          gifSaveOptions.dither = Dither.NONE;
          gifSaveOptions.matte = MatteType.NONE;
          gifSaveOptions.preserveExactColors = 0;
          gifSaveOptions.transparency = 1;

          activeDocument.saveAs(gifFile, gifSaveOptions, true, Extension.LOWERCASE);
          activeDocument.layers[i].visible = 0;
          }
     // it is a layer set
     else {
          // loop through the set
          for(var j=0; j<activeDocument.layers[i].artLayers.length; j++) {

               activeDocument.layers[i].artLayers[j].visible = 1;

               // set its name to layer name in a directory called "temp"
               // in the same location as the script
               gifFile = new File( "temp/"+activeDocument.layers[i].artLayers[j].name+".gif" );
               gifSaveOptions = new GIFSaveOptions();
               gifSaveOptions.colors = 256;
               gifSaveOptions.dither = Dither.NONE;
               gifSaveOptions.matte = MatteType.NONE;
               gifSaveOptions.preserveExactColors = 0;
               gifSaveOptions.transparency = 1;

               activeDocument.saveAs(gifFile, gifSaveOptions, true, Extension.LOWERCASE);
               activeDocument.layers[i].artLayers[j].visible = 0;
               }

          activeDocument.layers[i].visible = 0;
          }
     }
[via lucanboots@]
blog comments powered by Disqus
logo

Mat's Blog

California Dreaming

Users Status

You are not logged in.

Search

 

Get Firefox

Get Firefox!

Currently Reading


William Gibson, Jarreth Merz, Matthias Scherwenikas
Neuromancer, 3 Audio-CDs

Archive

October 2004
Sun
Mon
Tue
Wed
Thu
Fri
Sat
 
 
 
 
 
 1 
 2 
 3 
 4 
 6 
 8 
 9 
10
12
14
15
16
17
18
19
20
22
23
24
25
26
27
31
 
 
 
 
 
 
 

Recent Updates

und wie sieht es mit...
und wie sieht es mit deiner privaten Hochzeit aus? ;-) wünsche...
flog - 23. Oct, 20:49
Danke!
Danke Matthias für deinen Beitrag zu diesem Schritt....
Sierra - 22. Oct, 12:44
Ja, das Offline Problem...
Ja, das Offline Problem ist auch mein Hauptproblem....
matthias - 23. Sep, 14:36
ich verwende am Mac ausschließlich...
ich verwende am Mac ausschließlich die Browser...
smeidu - 23. Sep, 14:22
Stimmt -
Den Eindruck kann ich nur bestätigen; in der Bedienung...
N_Haase - 29. Jul, 13:24
Dach
und da oben am Dach, da sollte doch seit Jahren eine...
Sierra - 12. Jun, 10:47
but yammer accepts
no Austrian mobile numbers :(
cqeb - 15. Dec, 23:45
das verpasse ich leider......
das verpasse ich leider... http://twitter.com/flog/st atus/998712029
flog - 10. Nov, 21:38

Status

Online for 2675 days
Last update: 3. Mar, 15:52

Credits

vi knallgrau GmbH

powered by Antville powered by Helma


Creative Commons License

xml version of this page

twoday.net AGB