PhotoshopNews.com
Sep 5, 2007

How to express blend modes as curves

multiblendmodes.jpg

This tutorial is all about the relationship between Photoshop Curves and how all non-dissolve, per-channel Photoshop blend modes are equivalent to some kind of curve.
It has often been said that there is always more than one way to achieve an identical result in Photoshop. The trick of course is to work out which method is best for you or which is the most efficient.

As far as some people are concerned, Photoshop holds a certain mystique where it is assumed that a more complex approach will produce a more refined result. But very often the underlying math is the same as that used when applying a simpler approach. This is not to say that all tone adjustment methods can be reduced to a single curve, but the steps shown here are designed to illustrate the following three points:

1. It is always more efficient to use adjustment layer blend modes to ‘Screen’ or ‘Multiply’ an image rather than to duplicate the Background layer

2. An arbitrary map curve setting can be converted to a Photoshop Raw file format and edited in Photoshop.

3. By using this method to edit Curve settings, some cumulative image adjustments can be distilled into a single curve setting.

Adjustment layer blend modes

ca2006-0130-normal.jpg
Figure 1.

Figure 1 shows an unedited image where the sky requires darkening. The method we are going to use here is to use a Multiply blend mode to darken the overall image and then apply a black to white linear gradient to mask the bottom half of the picture. And in order to further darken the sky, we are going to duplicate the blend mode layer to produce a more pronounced darkening.

layerpalette-1.jpglayerpalette-2.jpg
Figure 2.

There are two ways you can do this. The most often taught method is to simply duplicate the Background layer and change the layer blend mode to Multiply. This will work, but when you save the image you will end up with a file which in this case will be three times the original file size!

A better alternative is to add an adjustment layer (any will do) without actually altering the settings and change the blend mode. This will achieve the exact same result as duplicating the Background layer but will only marginally increase the file size. So all you need to do is add an adjustment layer, let’s say a Curves adjustment layer, and click OK when the dialog appears to close it without editing the curve in any way. Then simply change the layer blend mode as before. It’s that simple.

ca2006-0130-darker.jpg

Figure 3. Here is the end result when using either of the methods described above. The sky only is darkened because the linear gradient hides the adjustment to prevent it affecting the lower half of the picture.

If you refer back to Figure 2 you will notice how I duplicated the Multiply layer and adjusted the layer opacity of this second layer to 60%. By altering the layer opacity and duplicating layers, you can have full control over the intensity of the ‘Multiply’ effect.

Convert a curves setting to a Photoshop image file
OK, now for the complex part. This next section reveals a little-known trick, in which you can convert a curves setting to a Photoshop Raw format image file, edit the image in Photoshop and save it back as a Curve setting. At this point I should mention that it was Russell Williams at Adobe who first showed me this tip and who helped clarify some of the points made here about the similarity between blend modes and Photoshop curves settings. Just remember that the steps discussed in this next section all relate to what can be summarized as the ‘non-dissolve, per-channel blend modes’ and excludes those other blend mode formulas like Hue, Color and Saturation that don’t operate on the individual channels.

Now, I have described all the steps here in detail so that those of you who are inclined to experiment are able to follow the exact same steps that I used. I appreciate that not everyone will be interested in these details, so if you like you can skip to the end of this article and download some of the settings I created using this method and put them to use.

Steps to edit a curve setting

0-saveamppreset.jpg

Step 1. I needed to create a gradient image that could be edited in Photoshop. One way to do this would be to create a new grayscale image that is exactly 1 x 256 pixels in size and draw a horizontal linear gradient going from black to white. But the gradient steps must be precise, where each pixel represents a discrete pixel value going from 0–255. The most accurate way to achieve this is to open the Curves dialog and click on the pencil icon to switch the Curves dialog to ‘arbitrary map’ mode. It is important that no edits are made to the curve. Next, I went to the dialog fly-out menu and chose Save Preset…

savepresetdilaog.jpg

starterpreset.jpg

Step 2. I then saved this preset to a desired location and clicked ‘Save’ to create the Cruves arbitrary map (.amp) setting shown here.

rawnamechange.jpg

rawpsfile.jpg

Step 3. I then wanted to convert the setting into a Photoshop Raw file. To do this I renamed the setting file, changing the file extension from ‘.amp’ to ‘.raw’.

1-openraw.jpg

Step 4. Now we can open the renamed raw file in Photoshop. You can use Bridge or the system navigation dialog to locate the file and then click Open.

2-psrawoptions.jpg3-1-imagesmaller1.jpg
Step 5. This next bit is quite critical. The Photoshop Raw Options dialog will appear next and here I entered the dimensions for the file we were about to open: 256 pixels for the width and 1 pixel for the height. In the Channels section it was important that I set the count to 1, which meant that we would be opening this file as a grayscale image. After I clicked OK, another dialog appeared telling me that the specified image is smaller than the source file. I clicked OK to open anyway.

3arawoptions.jpg

Step 6. At this stage the missing profile dialog may appear (depending on how you have the color management preferences configured) and it is important here to NOT color manage the file we are about to open.

4openedrawfile.jpg

Step 7. At last! We have managed to open the saved curve setting as a Photoshop image.

7-addcurve.jpg

Step 8. Now for the part where we edit the image file in Photoshop. In this example I added an adjustment layer and changed the blend mode to Multiply @ 100% layer opacity and then flattened the image to permanently edit the pixels in the file I had just opened. This is the stage where you can experiment using other blend modes, a combination of blend modes, or any other tone editing techniques that will work when applied to a grayscale image.

8-savecurve.jpg

9-saveoptions.jpg
Step 9. I saved the edited file to the Photoshop Curves presets folder. This can be accessed by going to the Photoshop application folder and locating the Curves folder inside the Presets folder. You will note here that I saved the file using the same Photoshop Raw file format, but I changed the extension to .amp when saving (in the ‘Save As’ section the file is saved as ‘Multiply.amp’). When I clicked Save, the Photoshop Raw Options dialog appeared and I simply clicked OK.

10-multiplycurve.jpg

Step 10. Now it is time to put the edited curve setting to use. I opened a new image, added a Curves adjustment layer and chose Load Preset… from the Curves dialog fly-out menu.

12-locatesetting.jpg

Step11. I located the recently saved Multiply.amp setting and clicked ‘Load’.

13-selectsetting.jpg

Step 12. This will load the curve setting for the multiply curve and append the setting to the list of presets that can be accessed via the Curves dialog Preset menu. As you can see below in Figure 4, one can use the steps described so far to add more presets to this list.

mastersettings.jpg
Figure 4. Here is a screen shot showing the Curves dialog where I had created and added curve settings for more Photoshop blend modes.

multiblendmodes.jpg

Figure 5. Here is a repeat view of the Curves dialog that was shown at the beginning of this article in which I have overlaid the curves used to define the Screen, Multiply, Soft Light and Overlay blend mode curves.

Putting theories to the test
There was a time when my instincts led me to believe that the Photoshop blend modes, in particular Screen and Multiply, performed some kind of special magic that made them superior to normal curves. I used to assume (incorrectly) that they somehow added levels to an image rather than simply stretched the existing levels in a picture, which is what Levels or Curves adjustments do. So one of the things this exercise allowed me to do was to directly compare blend mode created curves with basic blend mode adjustments.

As I said earlier, you can use the above steps to create your own set of blend mode curves, or if you want to cut out all the hard work, just download the ZIP file which contains a set of blend mode curves for you to experiment with.

In one test I did I took an image and duplicated it. For one version I added an adjustment layer, set the blend mode to say, Multiply and flattened the image. I then took the other version of the image, applied a Multiply curve and again flattened it. The two images should look identical. But not only that, they will statistically be identical too. One way to prove this is to overlay one of the images on top of the other in registration and set the blend mode to Difference. If the blended image is solid black, then you know that they are exactly the same. Now there is one point I will concede here. If you carry this out on an image that is in 8-bit per channel mode, the results will be identical. If you carry this out with an image that is in 16-bit per channel mode, the results will look the same but there will be a very slight difference in the statistical analysis. I raised this observation with Russell Williams, who explained that a curve map setting will specify an exact 256 values for the curve mapping and when this is applied to an image with more than 256 levels (i.e. a 16-bit image) it will have to interpolate the values that fall between those 256 points. Note here that the ‘interpolation’ here refers to the interpolation of the curve mapping for the in between curve values and this is true for any curves map mode type adjustment that is applied to a 16-bit image.

The other theory I wanted to test was whether blend mode adjustments will preserve more levels. The answer to this is no. A blend mode adjustment does exactly the same thing as a Levels or Curves adjustment, it simply maps the levels to new positions. Where clipping occurs some levels will be lost, but no levels will ever get added.

Blend modes use formulas to calculate the tone mapping and this it is argued, produces a smoother curve mapping when editing 16-bit images compared to using curve maps. This does appear to be true. For example, if you create a gradient test image in 16-bit, posterize it and compare the two different methods for adjusting the tones and then analyze the two histograms, the levels appear to shift more smoothly when you use the blend mode method of adjustment. So is the blend mode method still better? Possibly, although the difference between the two methods at 16-bit is so slight that it is hard to say which one is actually ‘better’. I would be interested to know what others think on this subject. As Russell Williams explained, the difference can be so negligible that the key conclusion would be to select whichever method was the most easy to use. This leads me to the final section where as an added exercise, I wanted to look at the possibility of merging multiple curves adjustments into one.

Merging cumulative adjustments into a single curve
At the beginning of this article I showed how two Multiply adjustments could be used to darken the sky in a beach seascape photograph. Now the chief advantage of working with adjustment layers is that you can mask the adjustment layer effect and the settings will remain editable. But when you add one adjustment layer on top of the other and flatten the image the image is effectively adjusted as if you had applied each of the curves adjustments sequentially. The downside of this is that the levels will get adjusted in sequence, one adjustment as a time, which is not the most efficient way to edit the tone levels in an image if you wish to preserve as much image detail as possible.

So for this final exercise I opened the standard Photoshop Raw linear gradient image and applied the same sequence of blend mode adjustment layers as were used in Figure 2 and applied these to the image, as shown in Figure 6. You will note that the uppermost adjustment layer has been set to 60% opacity, to match the settings used in Figure 2. I then flattened the image and saved the flattened file as a custom curve setting, naming it: ‘Multiply_100-60.amp’

15newsetting-1.jpg
Figure 6.

I then opened up the original beach scene photograph and applied this custom curve setting. Figure 7 shows the layers palette with the single Curves adjustment layer in place. Figure 8 shows the curve shape appearance of the custom curve. And finally, Figure 9, shows the end result, which is identical to the one at the beginning of this article that was created using a combination of two adjustment layers.

15newsetting-2.jpg
Figure 7.

15newsetting-3.jpg
Figure 8.

ca2006-0130-darker.jpg

Figure 9.

Conclusions
This main point of the exercises and steps shown here has been to provide some insight into the way Photoshop calculates its blend mode tone adjustments and how at one level you can say these have the same effect on an image as applying a normal curve adjustment.

Of course from a practical point of view it is not always going to be feasible to jump through all the hoops described here in order to create a ‘merged curves’ adjustment. But if for example you had a favorite tone mapping adjustment that involved say adding a gradient map adjustment followed by a curves adjustment to add a kick to the shadows followed by a layer blend options tweak, you could consider using the steps described in the last example to create a single curve setting that would let you achieve the same result in much less time.

But apart from that I did also want to demonstrate that in theory as well in practice, it could be possible for Photoshop to have a ‘merge adjustments’ feature in which certain types of multi-layered tone adjustments could be calculated as a single Curves adjustment.

Download the curve settings

If the above techniques interest you then you can download the curve settings as a ZIP file that I created for this article. The unstuffed folder will contain a Screen, Multiply, Soft Light and Overlay curve setting as well as the original Photoshop Raw file gradient image.

15 Responses to “How to express blend modes as curves”

  1. arne Says:

    Seriously this is one of the best tip and Photoshop insight I’ve ever heard of! Thank you so much for your article!
    I was just wondering if there is a way how one could use this technique also in RGB mode? This would be handy i.e. for simulating film color responses with curves. I could imagine that this will work, if one switches to rgb mode and then saves each color channel in a separate grayscale raw file. But then again: How does one load this three amp files into one curve adjustment layer? Maybe you have an idea.

    Thanks,
    Arne

  2. Martin Evening Says:

    When you open the Photoshop raw file, set the Channel count to 3 and uncheck the Interleaved option. This will open the image up as an RGB file in the default RGB workspace. You can then edit the individual channels and save as an.amp setting and then try loading as a preset.

    From what I can see this could work in colour, but I have not got around to testing how well it would work. If you try this out, let me know how you get on.

    Martin

  3. unDavide Says:

    Martin,
    I used to use two clipped adjustment layers (a multiply clipped to a luminosity, for instance) to retain only the desired effect (darker without any color/saturation shift in the previous example) Playing around with this led me to interesting effects (soft light on lighten, etc). Do you think your technique would work with these “composite” use of blending modes?
    Best regards and thanks for your enlightening article!

    Davide Barranca

  4. Martin Evening Says:

    Davide,
    I would say not, since the blend modes you mentioned (Luminosity and Lighten) are, like all blend modes, formulas used to calculate the resulting tone adjustment. The article points out that certain of these blend modes, such as Screen, Multiply, Overlay and soft light can effecively be summarised as curves and produce an identical processed result at 8-bit. With the other blend modes you can in some cases use the steps to create a tone curve setting, but you cannot replicate the exact effect with a tone curve alone. So for example, a Luminosity adjustment is filtering out the effect a tone adjustment has on the colour component. As you already know, you end up targeting the luminance only. The same with Lighten, you are applying a formula that is based on the image content.

    I would say stick with the technique you are already using and the only refinement I can suggest is to record the steps you use as an Action in order to apply this quickly.

    Martin

  5. Jann Lipka Says:

    Thanks a lot for very interesting adjustment approach !
    Very smart .raw workaraound , that sounds so usefull !

  6. arne Says:

    Martin, it worked exactly as you described. Though I’m getting spikes in the histogram with the applied curve, possibly due to the interpolations between the 256 values, there is no posterisation visible to me whatsoever. I just wonder: How is it possible that the interpolation is so “primitively linear”. Shouldn’t the imported amp-file automatically be transformed into a smooth spline curve, when you click the “Edit Points” button in the curves dialog? At least it appears to me that if you do so and edit one point just slightly, you can go back to “draw curve” and the dotted curve is smooth like a spline… though it does not change my spiked histogram.
    But maybe this is just nit picking :-)

  7. 01af Says:

    Wow! If reading this blog doesn’t turn us into Photoshop experts then I don’t know what …!

    Of course, representing blending modes as 256 x 1 pixel grayscale images (and consequently, as curves) works only because we are blending one image into itself. Is there also a method to represent the blending of *two* images as a grayscale image? It would be a 256 x 256 pixel image rather than 256 x 1. It would be nice to be able to create new custom blend modes this way …

    And where can I see the formulas for all the blend modes? I already know the formulas for Normal, Multiply, Screen, and Difference as those are simple enough. I’d like to know the others, too.

    – Olaf

  8. Andrew Rodney Says:

    [quote]As far as some people are concerned, Photoshop holds a certain mystique where it is assumed that a more complex approach will produce a more refined result. But very often the underlying math is the same as that used when applying a simpler approach. [/quote]

    This is the most useful statement about imaging process I’ve heard in a long time. I’m so sick and tired of some so called Photoshop guru’s who try to be macho and make a 48 step process in order to make the user think its worthwhile due to all the steps. If only all Photoshop instructors used their head, as Martin has done here to illustrate this isn’t so. If I had a dime for all the presentations and tips I’ve read that DON’T follow this KISS rule, I’d retire. Thanks Martin. While the tips here are superb, the theory expressed is equally important for Photoshop users.

  9. gamini Says:

    Martin..I like your books and this tutorial is brilliant !

    I totally agree with Andrew Rodney regarding “Photoshop gurus” who come up with all these strange esoteric steps (some as long as 55 steps) to do something when you can do the exact same thing in one or two simple steps.

    Remember Einstein said of Jean Piaget’s work “so simple that only a genius could have thought of it.”

    http://gamini.org

  10. Martin Evening Says:

    Sorry for the delay responding folks – I have been away on holiday for a couple weeks.

    Arne,

    I wish I knew the full answer here. My assumption is that a normal curve is like a bezier curve that uses mathematical expressions to describe the shape of the curve and therefore requires no interpolation to calculate the transformation of the levels at all points of the curve.

    When you switch to arbitrary map mode, the curve is controlled by 256 discrete curve points rather than a pure mathematical description and this is where interpolation has to be used to calculate the in-between values. How Photoshop translates between the two curve modes I don’t know. You raise an interesting question though. Can you create an .amp curve setting, switch to the normal point curve mode and save the setting out as a .crv setting? If you loaded .crv setting versions for the curves, would they be different to the .amp curves? Would you see a more precise match at 16-bit? I should give this a test.

    Martin

  11. ThaGangsta Says:

    woooow, this is the most weird thing I’ve learned for Photoshop so far :) ..thank you for the knowledge, sir :)

  12. arne Says:

    Martin, I’m highly interested in your results. Please send me an email if you got any further. Thanks

  13. photoshop-user Says:

    i really have to say, thank god for Photoshop Lightroom!

  14. Martin Evening Says:

    But Tone Curves aren’t so straight forward in Lightroom either!

    See: http://lightroom-news.com/2007/10/04/lightroom-versus-photoshop-curves/

    Martin

  15. vittiphoto Says:

    Dear Martin,

    Great article, learned much about the math behind Adobe xfer functions.

    scenario, I find Curves > Auto is usually pretty accurate, but find myself modifying the auto changes, reducing them. Is simply applying a Curves adjustment layer at 50% equivalent to halving the RGB moves made by the Curves > Auto function?

    TIA,

Leave a Reply

You must be logged in to post a comment.