Skip to content

Instantly share code, notes, and snippets.

@ilionic
Last active January 4, 2025 00:26
Show Gist options
  • Save ilionic/1028173bd1dc11218517a4361974ed59 to your computer and use it in GitHub Desktop.
Save ilionic/1028173bd1dc11218517a4361974ed59 to your computer and use it in GitHub Desktop.
/*
Script to gradualy increase opacity by layer and set blendMode in Photoshop
Usage:
Save script
In Photoshop assuming file is open with multiple layers
File -> Scripts -> Browse...
Select opacity-photoshop-script.jsx from file system
*/
var numLayers = app.activeDocument.layers.length; // total number of layers
var step = Math.round(100 / numLayers); // opacity step
var currentVal = step;
for (var x = 0; x < numLayers; x++) {
var layer = app.activeDocument.layers[x];
layer.blendMode = BlendMode.LIGHTEN; // set blending mode to Lighten
if (currentVal < 100) {
layer.opacity = currentVal;
}
if (numLayers === x-1) {
layer.opacity = 100; // make sure last one is always 100 opacity
}
currentVal += step;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment