Skip to main content
Known Participant
August 11, 2015
Answered

Apply Filter to Multiple Layers At Once (without converting to a SO)

  • August 11, 2015
  • 1 reply
  • 5465 views

Hey everyone,

I've looked everywhere for a way to simply apply the same filter to multiple layers at once, without first converting them to a Smart Object. I need to keep my layers intact and separate from the others. Does anyone know of a script or a way to do this?

Any reply is much appreciated.

-Andy

This topic has been closed for replies.
Correct answer I have gone

The ideal way to do this would be to get some script that records your selected layers. There is some on this site, but you will have to search for it. It's a little involved - lengthy code. But basically, you would make a loop and loop through the layers and then apply the code you got from script listener. Something like this which will apply the filters to all top level layers, which is most likely what you don't want, but it will show you the structure:

var doc = activeDocument;

for(var i=0;i<doc.layers.length;i++){

     try{//the try will prevent the script from stopping if you try and apply the blur to layers that can't be blurred

          doc.activeLayer = doc.layers;

          gBlur()//putting your code in a separate function, keeps things neat and less cluttered.

     }

     catch(e){}

}

function gBlur(){

var idGsnB = charIDToTypeID( "GsnB" );

    var desc2 = new ActionDescriptor();

    var idRds = charIDToTypeID( "Rds " );

    var idPxl = charIDToTypeID( "#Pxl" );

    desc2.putUnitDouble( idRds, idPxl, 0.300000 );

executeAction( idGsnB, desc2, DialogModes.NO );

}//end function


Paul has a script "Filter Selected Layers" on site that does most filters.

It's at the bottom of the "PSCS Scripts" section.

http://www.ps-bridge-scripts.talktalk.net/

1 reply

Chuck Uebele
Community Expert
Community Expert
August 11, 2015

You would have to apply the filter to each layer. You can use scriptlistener to record the filter settings, then use a loop to go through and apply them to the selected layers.

Andymc7Author
Known Participant
August 11, 2015

Hi Chuck, thanks for your response,

I'm not a scripter myself. I do have the listener, but if you would be so kind, what's the actual syntax of what you're describing?

the SL gave me this when I applied my .3 px gaussian blur to a given layer, that I would like to apply to multiple layers:

// =======================================================

var idAdobeScriptAutomationScripts = stringIDToTypeID( "AdobeScriptAutomation Scripts" );

    var desc1 = new ActionDescriptor();

    var idjsNm = charIDToTypeID( "jsNm" );

    desc1.putString( idjsNm, """ScriptListenerOn""" );

    var idjsMs = charIDToTypeID( "jsMs" );

    desc1.putString( idjsMs, """[ActionDescriptor]""" );

executeAction( idAdobeScriptAutomationScripts, desc1, DialogModes.NO );

// =======================================================

var idGsnB = charIDToTypeID( "GsnB" );

    var desc2 = new ActionDescriptor();

    var idRds = charIDToTypeID( "Rds " );

    var idPxl = charIDToTypeID( "#Pxl" );

    desc2.putUnitDouble( idRds, idPxl, 0.300000 );

executeAction( idGsnB, desc2, DialogModes.NO );

Stephen Marsh
Community Expert
Community Expert
June 2, 2019

Paul has a script "Filter Selected Layers" on site that does most filters.

It's at the bottom of the "PSCS Scripts" section.

http://www.ps-bridge-scripts.talktalk.net/


I just stumbled over this post, Paul's scripts have moved:

GitHub - Paul-Riggott/PS-Scripts: Photoshop Scripts

However, I can't see the script referenced above.