Thursday, November 17, 2005

Smart lazy

Noticed very quickly that there's a lot of repetitious work layering images and setting the opacity. In the spirit of laziness I've written a CS2 JavaScript that does this automatically. //-------------------- // Combine Documents to new layers // (c) 2005 Gordon McGregor // var numDocs = documents.length for (i = 1; i < numDocs ; i++) { // stack layers on doc o activeDocument = documents[i] activeDocument.artLayers["Background"].copy() activeDocument = documents[0] layerRef = documents[0].artLayers.add() documents[0].paste() layerRef.opacity = 100/(i+1) } for (i = numDocs-1; i >0 ; i--) { documents[i].close(SaveOptions.DONOTSAVECHANGES) } //---------------- If you want to use it, copy the text above and save it as Combine Docs to Layers.jsx in your Photoshop CS2/Presets/Scripts directory You can then run it from the File-Scripts menu (the first time you install it, if you already had photoshop running, you'll need to browse. If you start Photoshop after installing the script, it should appear on the script menu already. To use it, open all the documents you want to merge. Run the script. It'll use the first document open as the base layer, and then add the rest of the images on top of that layer. The layers decrease in opacity towards the highest layer. After building the document, all the other images will be closed.


clp69 said...

Gordon, the script is a real time saver. Thanks for sharing.


MikeW said...

So, does the script allow for layering swedish pancakes?

you lost me at hello.