PS Script to merge 2 or more Curves Layers (and other Adjustment Layers)

Discussion in 'Digital Negatives' started by Dan Pavel, Jun 23, 2018.

  1. Dan Pavel

    Dan Pavel Member

    Messages:
    89
    Joined:
    Sep 11, 2017
    Location:
    Constanta, Romania
    Shooter:
    Multi Format
    In the process of making corrections for the DN in some situations 2 or more Curves Adjustments have to be used. In such situations the possibility to merge the Curves into a single equivalent one would be quite handy. I have tried the ".RAW file -> .AMP file" path for the merging process but the results were not always correct, especially when working in the PS RGB mode with curves with different shapes for the R,G and B channels.
    That's why I made a script to merge 2 or more Curves Adjustment Layers into a single Curves Adjustment layer. In fact the script will merge more types of Adjustment Layers into a single Curves Adjustment layer equivalent with all the merged Adjustment Layers. It works in the PS-RGB mode with any kind of Curves Adjustments.

    You can download it here free of charge.

    INSTALL : unzip the file and copy the resulted folder into the Photoshop/Presets/Scripts folder. It contains 2 files, the script file and a small bitmap file needed for the script to run. Next time you'll open PS the "MergeAdjustmentLayers" script will appear under the "Scripts" menu.

    HOW TO USE IT :
    1. Open a new Document in PS, set the Image-Mode to RGB 8 or 16 Bits/Channel, load the Curves you want to merge into new Adjustment Curves Layers and run the script. Take care - the order of the Curves Adjustment Layers to be merged is important! Arranged in a different order the same Curves Adjustment Layers will produce different results.
    2. Open an existing Document that contains more Adjustment Layers (they don't need to be only Curves Adjustments) and any other Layers in PS. Keep "visible" only the Adjustment Layers you want to merge and make "invisible" all the other Layers. Run the script.
    THE RESULT : the script will add to your Document a Curves Adjustment Layer named "Merged Adjustments" with a red icon and marked "invisible". It contains a pen-Curve equivalent to merging all the visible Adjustment Layers of the types mentioned below from your Document.

    ADJUSTMENT LAYER TYPES THAT CAN BE MERGED :
    • BRIGHTNESS / CONTRAST
    • LEVELS
    • CURVES
    • EXPOSURE
    • VIBRANCE
    • HUE / SATURATION
    • COLOR BALANCE
    • PHOTO FILTER
    • INVERT
    • POSTERIZE
    • THRESHOLD
    • SELECTIVE COLOR
    All Layers of other types than the ones mentioned above as well as all Layer Masks and all "invisible"-marked Layers will be ignored in computing the resulting Curve.

    NOTE : the pen-Curve Adjustment is not really a curve. In fact it is a mapping graph allowing to map each of the 256 levels of gray into new values, one by one, without roundings or distortions induced by the strange curvatures that sometimes can appear in a Curves Adjustment drawn by other methods.
     
    Last edited: Jun 23, 2018
  2. ced

    ced Member

    Messages:
    496
    Joined:
    Oct 10, 2011
    Location:
    Belgica
    Shooter:
    Multi Format
    Groups:
    Dan this looks interesting and so I will give it a try. Thanks for making it freely available I am sure the community will appreciate your hard work!
     
  3. nmp

    nmp Member

    Messages:
    450
    Joined:
    Jan 20, 2005
    Shooter:
    35mm
    Just downloaded and used it on two curves. Worked like a charm!

    Dan, you are a genius, and generous one at that....

    Thanks.

    :Niranjan.
     
  4. ced

    ced Member

    Messages:
    496
    Joined:
    Oct 10, 2011
    Location:
    Belgica
    Shooter:
    Multi Format
    Groups:
    Dan, just tried out your great script and it does the job just as I personally needed. Thanks again for your effort!
     
  5. nmp

    nmp Member

    Messages:
    450
    Joined:
    Jan 20, 2005
    Shooter:
    35mm
    Hi, Dan:

    So I played around some more with different types of adjustments. So far it worked for Brightness & Contrast, Levels, Curves. I got stuck at Hue and Saturation. If I try to merge 2 layers of that, it ends up the same as the background layer. What could be going wrong?

    Also, can this be used to mix and match different adjustment layers? Like combining one Curves and one Levels, etc or do they have to be of same kind.

    I am intrigued by the fact that all these different types of adjustment layers can be translated in to one Curves layer...

    :Niranjan.
     
  6. OP
    OP
    Dan Pavel

    Dan Pavel Member

    Messages:
    89
    Joined:
    Sep 11, 2017
    Location:
    Constanta, Romania
    Shooter:
    Multi Format
    Hi ced & Niranjan.
    You are welcome, gentleman.

    Niranjan.@
    You are right, Niranjan, about Hue and Saturation. The script analizes a 256 grays step-wedge to which it applies all the adjustments.
    Applying Hue and Saturation as well as Vibrance or Selective Color to a grayscale-only image in PS, even if in RGB mode, let the image unchanged in most situations. You can test it with a B&W image opened in PS in RGB mode and you'll see the changes Hue and Saturation, Vibrance and Selective Color produce on it. Only if the Lightness slider is moved from the middle the other sliders would make changes in the image. This difference between how this adjustments work on a B&W image and on a coloured one in PS is quite strange. One would expect that on a B&W image opened in the RGB mode in PS changing the reds saturation and lightness with Hue and Saturation would produce a color change. Well, it doesn't.
    Things get even stranger with the Selective Color Adjustment on the same image: select any color (except for white, gray and black) , move all the sliders as you wish and you'll see no changes in the B&W image opened in RGB mode. This strange PS behavior is the reason of what you have observed. The only solution to this behavior is to exclude this adjustments from the list of adjustments that can be merged. I'll make the script ignore them, as well. Thanks for pointing it out.
    So, please consider excluded from the ADJUSTMENT LAYER TYPES THAT CAN BE MERGED the VIBRANCE, HUE/SATURATION and SELECTIVE COLOR ADJUSTMENTS.

    Yes, any adjustment layers from the list, in any number, can be mix and match. They don't need to be of the same kind. They can be simple layers or included in layer groups, as well. In the case of layer groups the resulted curve won't be made in the topmost position, but above the simple layers in the document (this could be below some groups).

    My intention is to be able to use this script while in the middle of the work at a document, without closing it. I can make invisible the layers I want ignored, then run the script to get a replacement-curve for the visible ones and in the end delete them and only keep the "Merged Adjustments" pen-curve layer. If layers are masked the script will ignore all masks. The script will make absolutely no changes to the starting document (with the exception of adding the "Merged Adjustments" layer).

    Yes, me too. That's the power of the pen-curve adjustment. I have ignored this adjustment till now but it seems it's the most powerful of all the PS adjustments.
     
    Last edited: Jun 25, 2018
  7. nmp

    nmp Member

    Messages:
    450
    Joined:
    Jan 20, 2005
    Shooter:
    35mm
    It is actually not quite that strange. These color changing adjustment layers are dependent on "colors" of the original layer as defined by their location in in the RGB space. A black and white image will have no pixels in those zones, hence no change if move around the numbers. It is kind of like having an invisible mask for a particular color. If you move the Green in Hue and Sat layer on a grey image, the mask of of green will be all black so no change is observed if you add or remove that color. Curves is the only one true that maps one RGB value to another for the whole space regardless of where the original point is.
     
  8. OP
    OP
    Dan Pavel

    Dan Pavel Member

    Messages:
    89
    Joined:
    Sep 11, 2017
    Location:
    Constanta, Romania
    Shooter:
    Multi Format
    This would be normal for the R, G and B channels in the RGB mode. Changes to, let's say R channel won't affect at all the G and B channels. But, at least to me, it's strange that blacks show the same behavior, as there is no Black channel. A shade of gray should be a mixture of the R,G and B channels (equal R, G and B values) and therefore it should be affected by changes in each of them. It looks like, IMO, the mentioned PS adjustments are considering the RGB image as RGBK.
     
  9. nmp

    nmp Member

    Messages:
    450
    Joined:
    Jan 20, 2005
    Shooter:
    35mm
    I think you are looking at, if I understand correctly, the "Greens" in the Hue/Sat as the G channel in RGB. It is not. That is what I was trying to explain. Probably not doing a good job. It simply is a collection of pixels that fall in the "green" zone as defined by Adobe (which can be readjusted with the eye dropper tool or the sliding scale at the bottom.) In a gray image, there are no greens (or reds, or yellows, etc) so changing any of the H, S, or L on the Greens drop-down would do nothing at all. It is like if you go in Select> Color Range and sample "greens." Nothing would be selected.
     
  10. OP
    OP
    Dan Pavel

    Dan Pavel Member

    Messages:
    89
    Joined:
    Sep 11, 2017
    Location:
    Constanta, Romania
    Shooter:
    Multi Format
    I'v got it now. You say that the 3 adjustments seam to work on collections of pixels in the selected color range and not on the whole image. This keeps grays out of any color range and therefore they are not affected.
    If you chose "Colorize" with Hue/Saturation than it works on the whole image and it affects grays as well.
    Yes, this could be the case.
    Anyway, they should be taken off the list of accepted adjustments in my script.
    I have noticed that Threshold should be taken off the list, as well. The corrected list should be :

    ADJUSTMENT LAYER TYPES THAT CAN BE MERGED :
    • BRIGHTNESS / CONTRAST
    • LEVELS
    • CURVES
    • EXPOSURE
    • COLOR BALANCE
    • PHOTO FILTER
    • INVERT
    • POSTERIZE
     
    Last edited: Jun 25, 2018
  11. OP
    OP
    Dan Pavel

    Dan Pavel Member

    Messages:
    89
    Joined:
    Sep 11, 2017
    Location:
    Constanta, Romania
    Shooter:
    Multi Format
    I have updated the script with the corrected list of Layer Types that can be merged. In the Photoshop/Presets/Scripts folder replace the old "Merge Adjustments" folder with the new one.
    The download link is here .
    Photo Filter was removed as well, for the same reason as the other removed filters.
     
    Last edited: Jun 27, 2018
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies. If you have a Photrio account, please log in (and select 'stay logged in') to prevent recurrence of this notice.