This content has been marked as final.
Show 4 replies
-
1. Re: Save Selected Layers (started in general photoshop forum)
Michael L Hale Jan 11, 2010 7:39 PM (in response to k.loy)Are any of your layers in layersets? What you want can be scripted but it will run faster if it doesn't have to deal with layerset.
-
2. Re: Save Selected Layers (started in general photoshop forum)
k.loy Jan 11, 2010 7:47 PM (in response to Michael L Hale)nope, no layer sets
-
3. Re: Save Selected Layers (started in general photoshop forum)
Michael L Hale Jan 11, 2010 8:07 PM (in response to k.loy)Well this might need some fine tuning but it will save each layer with the top(border) layer as a jpg in the same folder as the document using the layer's name as the filename.
// refence to selected document var doc = app.activeDocument; // path to doc var saveFolder = doc.path; // referece to top layer var borderLayer = doc.layers[0]; // make top layer the active layer doc.activeLayer = borderLayer; // hide all the other layers hideOtherLayers(); // loop remaining layer and save each with border for( var i = 1; i < doc.layers.length; i++ ){ // reference the layer var current = doc.layers[i]; // turn on the layer current.visible = true; // save the layer with border saveAsJPG( new File( saveFolder+'/'+current.name+'.jpg'), 8 ); // turn off layer current.visible = false; // next layer } function hideOtherLayers(){//activeLayer var desc = new ActionDescriptor(); var ref = new ActionReference(); var list = new ActionList(); ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) ); list.putReference( ref ); desc.putList( charIDToTypeID( "null" ), list ); desc.putBoolean( charIDToTypeID( "TglO" ), true ); executeAction( charIDToTypeID( "Shw " ), desc, DialogModes.NO ); } function saveAsJPG( saveFile, jpegQuality ){ jpgSaveOptions = new JPEGSaveOptions(); jpgSaveOptions.embedColorProfile = true; jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE; jpgSaveOptions.matte = MatteType.NONE; jpgSaveOptions.quality = jpegQuality; activeDocument.saveAs( saveFile, jpgSaveOptions, true,Extension.LOWERCASE ); } -
4. Re: Save Selected Layers (started in general photoshop forum)
k.loy Jan 11, 2010 8:36 PM (in response to Michael L Hale)wow!! thanks! i'll give it a whirl right away!

