Skip to main content
Participating Frequently
May 8, 2024
Answered

applying blend mode for layer

  • May 8, 2024
  • 2 replies
  • 365 views

hi all,
i have 2 layer layer2 and layer1
layer2 is top layer and layer1 is a bottom layer.
here i want apply blend mode exclusion for layer2 
through code how can we apply blend mode for layer.
please provide me code for this and if possible can anyone help me to provide code for other blending mode too.
Thank You

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer Stephen Marsh

Presuming ExtendScript, here is DOM code for changing the blend mode without selecting the top layer, regardless of the layer name:

 

app.activeDocument.layers[0].blendMode = BlendMode.EXCLUSION;

 

Or by selecting the top layer, then changing it's blend mode, regardless of the layer name:

 

app.activeDocument.activeLayer = app.activeDocument.layers[0];
app.activeDocument.activeLayer.blendMode = BlendMode.EXCLUSION;

 

https://theiviaxx.github.io/photoshop-docs/Photoshop/BlendMode.html

 

Edit:

 

I you want to use the explicit layer name:

 

app.activeDocument.layers.getByName("Layer 2").blendMode = BlendMode.EXCLUSION;

 

or

 

app.activeDocument.activeLayer = app.activeDocument.layers.getByName("Layer 2");
app.activeDocument.activeLayer.blendMode = BlendMode.EXCLUSION;

 

2 replies

c.pfaffenbichler
Community Expert
Community Expert
May 8, 2024

Could you please post screenshots taken at View > 100% with the pertinent Panels (Toolbar, Layers, Options Bar, …) visible? 

Can there be more Layers in the image? 

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
May 8, 2024

Presuming ExtendScript, here is DOM code for changing the blend mode without selecting the top layer, regardless of the layer name:

 

app.activeDocument.layers[0].blendMode = BlendMode.EXCLUSION;

 

Or by selecting the top layer, then changing it's blend mode, regardless of the layer name:

 

app.activeDocument.activeLayer = app.activeDocument.layers[0];
app.activeDocument.activeLayer.blendMode = BlendMode.EXCLUSION;

 

https://theiviaxx.github.io/photoshop-docs/Photoshop/BlendMode.html

 

Edit:

 

I you want to use the explicit layer name:

 

app.activeDocument.layers.getByName("Layer 2").blendMode = BlendMode.EXCLUSION;

 

or

 

app.activeDocument.activeLayer = app.activeDocument.layers.getByName("Layer 2");
app.activeDocument.activeLayer.blendMode = BlendMode.EXCLUSION;