Get and Set Layer Style (Blending Options & Layer Effects)

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

Mikaeru

Get and Set Layer Style (Blending Options & Layer Effects)

Post by Mikaeru »

FYI, I've just released version 3.5 of the JSON Action Manager scripting library. Among other things, it adds a new module jamStyles which provides full support for getting and setting layer styles (both blending options and layer effects) programmatically, using a JSON simplified format. It also allows the parsing of styles files into a JSON text file, although embedded patterns are not completely handled yet.

Two sample scripts are already provided:
Get Layer StyleParse Styles File
The script "Get Layer Style" (for Photoshop CS2 or later) lets you get the layer style of the current layer in JSON text format (it actually calls the function jamStyles.getLayerStyle). You can then pass the resulting JSON text to the function jamStyles.setLayerStyle to set a layer style in your own scripts. Here is one simple example:

Code: Select alljamStyles.setLayerStyle
(
    {
        "blendOptions":
        {
            "mode": "difference",
            "opacity": 100,
            "fillOpacity": 70,
            "blendInterior": true
        },
        "layerEffects":
        {
            "scale": 100,
            "solidFill":
            {
                "enabled": true,
                "mode": "normal",
                "opacity": 100,
                "color": { "red": 125, "green": 0, "blue": 215 }
            },
            "dropShadow":
            {
                "enabled": true,
                "mode": "multiply",
                "color": { "red": 0, "green": 0, "blue": 0 },
                "opacity": 70,
                "localLightingAngle": 135,
                "useGlobalAngle": false,
                "distance": 10,
                "chokeMatte": 20,
                "blur": 15,
                "transparencyShape":
                {
                    "name": "Linear",
                    "curve":
                    [
                        { "horizontal": 0, "vertical": 0 },
                        { "horizontal": 255, "vertical": 255 }
                    ]
                },
                "antiAlias": false,
                "noise": 8,
                "layerConceals": true
            }
        }
    }
);

Please let me know if you have any comments, corrections or suggestions.

--Mikaeru
Mikaeru

Get and Set Layer Style (Blending Options & Layer Effects)

Post by Mikaeru »

Version 3.5.1 of the open-source JSON Action Manager scripting library is now available; it is a minor update of the new module jamStyles, used by the scripts Get Layer Style and Parse Styles File (which have been updated as well).

A new tutorial named Layer Styles Quick Tutorial has also been released; it provides practical examples of how to:

Set a layer style Clear a layer style Set blending options Display blending options Reset blending options Check if a layer has effects Check if a layer effect exists Display layer effect parameters Obtain a layer effect parameter Modify a layer effect parameter Remove a layer effect Remove all layer effects Remove unused layer effects