Skip to main content
Participant
July 24, 2024
Question

Photoshop Scripting - Smartlayer stack mode mean

  • July 24, 2024
  • 1 reply
  • 199 views

Hi,

I have a script that calculates the median of some images that are loaded automatically into PS. I want to change the median to mean, but I can't find any good documentation about PS scripting, does anyone know how to do that? Here's my code for calculating the median:

 

function makeMedian(){

var idapplyImageStackPluginRenderer = stringIDToTypeID( "applyImageStackPluginRenderer" );

var desc6 = new ActionDescriptor();

var idimageStackPlugin = stringIDToTypeID( "imageStackPlugin" );

var idmedn = charIDToTypeID( "medn" );

desc6.putClass( idimageStackPlugin, idmedn );

var idNm = charIDToTypeID( "Nm " );

desc6.putString( idNm, """Median""" );

executeAction( idapplyImageStackPluginRenderer, desc6, DialogModes.NO );

}

 

Thanks!

This topic has been closed for replies.

1 reply

c.pfaffenbichler
Community Expert
Community Expert
July 24, 2024

Seems to record just fine with ScriptingListener.plugin

// =======================================================
var idapplyImageStackPluginRenderer = stringIDToTypeID( "applyImageStackPluginRenderer" );
    var desc8 = new ActionDescriptor();
    var idimageStackPlugin = stringIDToTypeID( "imageStackPlugin" );
    var idavrg = charIDToTypeID( "avrg" );
    desc8.putClass( idimageStackPlugin, idavrg );
    var idname = stringIDToTypeID( "name" );
    desc8.putString( idname, "Mean" );
executeAction( idapplyImageStackPluginRenderer, desc8, DialogModes.NO );
Participant
July 24, 2024

Wow, thank you so much! I totally forgot about the plugin... It's been a while since I actively used PS

c.pfaffenbichler
Community Expert
Community Expert
July 24, 2024

You’re welcome!