Last active
January 4, 2025 00:26
-
-
Save ilionic/1028173bd1dc11218517a4361974ed59 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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