Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


How to merge a single adjustment to multiple layers individually?

New Here ,
Apr 23, 2021 Apr 23, 2021

Copy link to clipboard

Copied

I have a hue/saturation adjustment layer and underneath are about 100 layers that I want to specifically merge the adjustment layer to each one individually. I need to keep each of these 100 layers separated – I don't want to merge them all together and I don't want to group the layers. Right now, I would duplicate the adjustment layer 100 times and merge it one by one. That's not really the most productive and I figured someone may have a solution to this. I have this issue on a daily basis so this would improve my productivity tremendously. Could anyone provide a step-by-step solution? I am open to scripts but I don't know much about scripts so if you do have a script could you send it as a .jsx file or please explain to me how to turn the script text into a workable script file on a Mac. I have tried to figure it out so many times (using textedit and scripteditor on Mac) and I can never get them to turn into a loadable .jsx file for scripts in photoshop.

TOPICS
Actions and scripting, macOS

Views

540

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Apr 23, 2021 Apr 23, 2021
Without creating a script for your specific personal workflow, I will suggest the following: 1) Take note of the adjustment layer settings and delete it. 2) Record a two-step action that changes the selected layer directly using hue/saturation or whatever you have done via the adjustment layer. The second step of this action will be to "Select backward layer", this step is recorded using the  opt/alt [  keys (hold down the option or alt key while pressing the opening left square bracket key)...

Likes

Translate

Translate
Adobe Community Professional ,
Apr 23, 2021 Apr 23, 2021

Copy link to clipboard

Copied

Record an action to add the adjustment to the current layer and clipped to it. Then target the next layer up in the layer stack. Once you have that action recorded open the document with all the layers you want to add the adjustment to.  Target the bottom most layer in the layer stack you want to add the adjustment to.  Highlight the Action in the Action palette and click the play button.  If after the adjustment has be clipped to the layers and the next layer up in the stack is targeted if it is a layer you  want to add the adjustment click the play button. If it not a layer you want to add the adjustment to,  target one that is and click the play button.  Actions are for repetitive processing.

JJMack

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 23, 2021 Apr 23, 2021

Copy link to clipboard

Copied

Why would you want to merge that one adjustment to each layer, therefore making it destructive?

 

Why not group the layers together and then non-destructively apply the adjustment? You can clip it to the group to only affect the group.

 

(Even better is you can make a group a Smart Object and then non-destructively add a filter that you couldn't before like Blur Gallery.)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Apr 23, 2021 Apr 23, 2021

Copy link to clipboard

Copied

Without creating a script for your specific personal workflow, I will suggest the following:

 

1) Take note of the adjustment layer settings and delete it.

 

2) Record a two-step action that changes the selected layer directly using hue/saturation or whatever you have done via the adjustment layer. The second step of this action will be to "Select backward layer", this step is recorded using the  opt/alt [  keys (hold down the option or alt key while pressing the opening left square bracket key). Stop recording the action, you'll have something like this:

 

atn.png

 

Attention: It is expected that the selected layers are contiguous for the action to work as intended and that the selected layers are layers that can be edited with an adjustment. 

 

3) Copy the following JavaScript code and use the instructions linked below to save and run the JavaScript script. You will need to know exactly how many layers there are to change and enter that number into the script prompt:

 

// Repeat action N times GUI
// https://forums.adobe.com/thread/2649334
// https://forums.adobe.com/message/11234144#11234144

#target photoshop

// Loop the input prompt until a number is entered
var origInput;
while (isNaN(origInput = prompt("Enter a whole number:", "3")));
// Convert decimal input to integer
var inputToInteger = parseInt(origInput);

function main() {
    for (i = 0; i < inputToInteger; i++) // Variable prompt N times
    {
        // Change the action and action set as required        
        app.doAction("test-action", "test-set");
    }
}

app.activeDocument.suspendHistory("Repeat action N times (history suspended)", "main()");

 

Downloading and Installing Adobe Scripts

 

 

The following script will automatically count the selected layers and play the nominated action the required amount of times for each layer. You will still need to use an action as previously described and change the action set and action name.

 

Attention: It is expected that the selected layers are contiguous for the action to work as intended and that the selected layers are layers that can be edited with an adjustment. 

#target photoshop
    
function main() {

        makeDupe("", 5);
        var layerCount = app.activeDocument.layers.length;
        app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
        makeGroup("", 17, 18, "");
        deleteGroup(false);
        
        // Loop the action over contiguous selected layers
        for (i = 0; i < layerCount; i++) {
            // Change the name of the action and action set as required
            app.doAction("test-action", "test-set");
        }

        function makeDupe(name2, version) {
            // Dupe selected layers to temp doc
            // This is a quick hack method, not best practice code!
            var c2t = function (s) {
                return app.charIDToTypeID(s);
            };
            var s2t = function (s) {
                return app.stringIDToTypeID(s);
            };
            var descriptor = new ActionDescriptor();
            var reference = new ActionReference();
            var reference2 = new ActionReference();
            reference.putClass(s2t("document"));
            descriptor.putReference(c2t("null"), reference);
            descriptor.putString(s2t("name"), "", "TempLayerCountDoc", name2);
            reference2.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
            descriptor.putReference(s2t("using"), reference2);
            descriptor.putInteger(s2t("version"), version);
            executeAction(s2t("make"), descriptor, DialogModes.NO);
        }

        function makeGroup(name2, layerSectionStart, layerSectionEnd, name3) {
            // Group selected layers
            // This is a quick hack method, not best practice code!
            var c2t = function (s) {
                return app.charIDToTypeID(s);
            };
            var s2t = function (s) {
                return app.stringIDToTypeID(s);
            };
            var descriptor = new ActionDescriptor();
            var descriptor2 = new ActionDescriptor();
            var reference = new ActionReference();
            var reference2 = new ActionReference();
            reference.putClass(s2t("layerSection"));
            descriptor.putReference(c2t("null"), reference);
            reference2.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
            descriptor.putReference(s2t("from"), reference2);
            descriptor2.putString(s2t("name"), "", "groupHack", name2);
            descriptor.putObject(s2t("using"), s2t("layerSection"), descriptor2);
            descriptor.putInteger(s2t("layerSectionStart"), layerSectionStart);
            descriptor.putInteger(s2t("layerSectionEnd"), layerSectionEnd);
            descriptor.putString(s2t("name"), "", "groupHack", name3);
            executeAction(s2t("make"), descriptor, DialogModes.NO);
        }

        function deleteGroup(deleteContained) {
            // Delete group, not contents
            // This is a hack to target the top layer of the previous selection
            var c2t = function (s) {
                return app.charIDToTypeID(s);
            };
            var s2t = function (s) {
                return app.stringIDToTypeID(s);
            };
            var descriptor = new ActionDescriptor();
            var reference = new ActionReference();
            reference.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
            descriptor.putReference(c2t("null"), reference);
            descriptor.putBoolean(s2t("deleteContained"), deleteContained);
            executeAction(s2t("delete"), descriptor, DialogModes.NO);
        }

    }

app.activeDocument.suspendHistory("Run script", "main()");

There are undoubtedly many better ways to do this, but this is what I came up with at my current knowledge level in the shortest amount of time to get the job done. I'd of course appreciate learning better methods to do what I hacked together here.

 

 

I couldn't get the following script to work, however, it is worth linking up the two topics for future reference:

 

Applying adjustment layer to multiple layers

 

 

Apply Adjustment Layers 2.0 Script for Photoshop

Apply Adjustment Layers 2.0 Script for Photoshop

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 23, 2021 Oct 23, 2021

Copy link to clipboard

Copied

Huge thanks @Stephen_A_Marsh !
Apply Adjustment Layers 2.0 Script for Photoshop was pure genius.
I've been searching for a solution to this problem like forever. And when starting to mess around with Procreate I realized they had this solution, it made me nuts not being able to do the same in PS.
I urge anyone who needs a solution to this problem to buy this script. I paid 2 bucks, but the work gone into this has to have been pretty huge, so hoping ppl will see this and chip in. Well worth it 🙂

For anyone interested, it worked flawlessly on my:
Photoshop 2021 (22.5.1), MacOS 11.6

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 23, 2021 Oct 23, 2021

Copy link to clipboard

Copied

LATEST

I'm glad that the script from Mike McCain worked for you!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 23, 2021 Oct 23, 2021

Copy link to clipboard

Copied

"I couldn't get the following script to work(...)" / The codes have been corrected. Try again...

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines