Blend modes (or Mixing modes) in digital image editing and computer graphics are used to determine how two layers are blended into each other. The default blend mode in most applications is simply to hide the lower layer with whatever is present in the top layer. However, as each pixel has a numerical representation, a large number of ways to blend two layers is possible. The top layer is not necessarily called a "layer" in the application. It may be applied with a painting or editing tool. The top layer can also be referred to as the "blend layer" or "active layer".
In the formulas shown on this page, values go from 0.0 (black) to 1.0 (white).
- 1 Normal blend mode
- 2 Dissolve
- 3 Multiply and Screen
- 4 Dodge and burn
- 5 Simple arithmetic blend modes
- 6 Boolean arithmetic blend modes
- 7 Hue, saturation and luminosity
- 8 Relation to masking
- 9 Differences between layer and tool blending
- 10 See also
- 11 References
Normal blend mode
where a is the value of a color channel in the underlying layer, and b is that of the corresponding channel of the upper layer. The result is most typically merged into the bottom layer using "simple" (b over a) alpha compositing (making the actual formula ), but other Porter-Duff operations are possible. The compositing step results in the top layer's shape, as defined by its alpha channel, appearing over the bottom layer.
The dissolve mode takes random pixels from both layers. With high opacity, most pixels are taken from the top layer. With low opacity most pixels are taken from the bottom layer. No anti-aliasing is used with this blend mode, so the pictures may look grainy and harsh.
Within Adobe Photoshop, dissolve mode uses a pseudo-random seed to generate a noise pattern at application launch, where each pixel location in a 2D raster array is assigned a gray value. As the opacity of the top layer is reduced, discrete gray values are switched from an alpha binary value of 1 (e.g., "on") to 0 (e.g., "off"), meaning that image pixels corresponding to a gray-valued pixel in the raster array are either visible or transparent, with no opacity gradation.
Multiply and Screen
Multiply and Screen blend modes are basic blend modes for darkening and lightening images, respectively. There are several different combinations of them like Overlay or Soft Light (mentioned further down) and Vivid Light, Linear Light and Pin Light.
Multiply blend mode multiplies the numbers for each pixel of the top layer with the corresponding pixel for the bottom layer. The result is a darker picture.
, where a is the base layer value and b is the top layer value.
This mode is symmetric: exchanging two layers does not change the result. If the two layers contain the same picture, multiply blend mode is equivalent to a quadratic curve, or gamma correction with γ=2. (For image editing it is sometimes more convenient to simply go to the Curves dialog of the software, as it gives more flexibility in the shape of the curves. Or one can use Levels dialogue — the middle number is usually 1/γ, so one can just type 0.5.)
If one layer contains a homogeneous color, for example the gray color (0.8, 0.8, 0.8), multiply blend mode is equivalent to a curve which simply is a straight line. This is also equivalent to using this gray value as opacity when doing “normal mode” blend with black bottom layer.
With Screen blend mode the values of the pixels in the two layers are inverted, multiplied, and then inverted again. This yields the opposite effect to multiply. The result is a brighter picture.
, where a is the base layer value and b is the top layer value.
This mode is symmetric: exchanging two layers does not change the result. If one layer contains a homogeneous gray, Screen blend mode is equivalent to using this gray value as opacity when doing “normal mode” blend with white top layer.
Overlay combines Multiply and Screen blend modes, at half strength. The parts of the top layer where the base layer is light become lighter, the parts where the base layer is dark become darker. Areas where the top layer are mid grey are unaffected. An overlay with the same picture looks like an S-curve.
where a is the base layer value and b is the top layer value.
Depending on the value a of the base layer, one gets a linear interpolation between black (a=0), the top layer (a=0.5), and white (a=1).
Hard Light is also a combination of Multiply and Screen; each at half "strength". Hard Light affects the blend layer's relationship to the base layer in the same way Overlay affects the base layer's relationship to the blend layer. The inverse relationship between Overlay and Hard Light makes them "commuted blend modes".
Soft light is most closely related to Overlay and is only similar to Hard Light by name. Applying pure black or white does not result in pure black or white[example needed].
There are a variety of different methods of applying a soft light blend. All the flavors produce the same result when the top layer is pure black; same for when the top layer is pure neutral gray. The Photoshop and illusions.hu flavors also produce the same result when the top layer is pure white (the differences between these two are in how one interpolates between these 3 results).
These three results coincide with gamma correction of the bottom layer with γ=2 (for top black), unchanged bottom layer (or, what is the same, γ=1) (for top neutral gray), and γ=0.5 (for top white).
The formula used by Photoshop as of 2012 has a discontinuity of local contrast, and other formulas correct it. Photoshop's formula is:
where a is the base layer value and b is the top layer value. Depending on b, one gets a linear interpolation between three gamma corrections: γ=2 (for b=0), γ=1 (for b=0.5), and γ=0.5 (for b=1).
This is a linear interpolation between gamma correction with γ=2 (for b=0), and a certain tonal curve (for b=1). (The latter curve is equivalent to applying γ=2 to the negative of image.)
For b=0, one still gets γ=2, for b=0.5 one gets γ=1, for b=1 one gets γ=0.5, but it is not a linear interpolation between these 3 images.
It is still a linear interpolation between 3 images for b=0, 0.5, 1. But now the image for b=1 is not γ=0.5, but the result of a tonal curve which differs from the curve of γ=0.5 for small values of a: while gamma correction with γ=0.5 may increase the value of a many times, this new curve limits the increase of a by coefficient 4.
Dodge and burn
Dodge and burn change the lightness of the pictures, inspired by the dodging and burning performed in a darkroom. Dodging lightens an image, while burning darkens it. Dodging the image is the same as burning its negative (and vice versa).
- Dodge modes:
- The Screen blend mode inverts both layers, multiplies them, and then inverts that result.
- The Color Dodge blend mode divides the bottom layer by the inverted top layer. This lightens the bottom layer depending on the value of the top layer: the brighter the top layer, the more its color affects the bottom layer. Blending any color with white gives white. Blending with black does not change the image. The operation is not invertible due to possible clipping of highlights. (The clipping happens in the same area as for the Linear Dodge.) When top layer contains a homogeneous color, this effect is equivalent to changing the white point to the inverted color. The perceived contrast increases when there is no clipping.
- The Linear Dodge blend mode simply sums the values in the two layers (also known as additive blending). Blending with white gives white. Blending with black does not change the image. When top layer contains a homogeneous color, this effect is equivalent to changing the output black point to this color, and (input) white point to the inverted color. The contrast is decreased when there is no clipping.
- Divide: Same as "Color Dodge", but blending with white does not change the image.
- Burn modes:
- The Multiply mode simply multiplies each component in the two layers.
- The Color Burn mode divides the inverted bottom layer by the top layer, and then inverts the result. This darkens the top layer increasing the contrast to reflect the color of the bottom layer. The darker the bottom layer, the more its color is used. Blending with white produces no difference. When top layer contains a homogeneous color, this effect is equivalent to changing the black point to the inverted color. The operation is not invertible due to possible clipping of shadows. The clipping happens in the same area as for the Linear Burn.
- The Linear Burn mode sums the value in the two layers and subtracts 1. This is the same as inverting each layer, adding them together (as in Linear Dodge), and then inverting the result. Blending with white leaves the image unchanged.
- Vivid Light: this blend mode combines Color Dodge and Color Burn (rescaled so that neutral colors become middle gray). Dodge applies when values in the top layer are lighter than middle gray, and burn to darker values. The middle gray is the neutral color. When color is lighter than this, this effectively moves the white point of the bottom layer down by twice the difference; when it is darker, the black point is moved up by twice the difference. (The perceived contrast increases.)
- Linear Light: this blend mode combines Linear Dodge and Linear Burn (rescaled so that neutral colors become middle gray). Dodge applies to values of top layer lighter than middle gray, and burn to darker values. The calculation simplifies to the sum of bottom layer and twice the top layer, subtract 1. The contrast decreases.
- Subtract: this blend mode sums the value in the two layers and subtracts 1. Unlike Linear Burn, blending with white affects the image.
Simple arithmetic blend modes
This blend mode simply divides pixel values of one layer with the other, but it's useful for brightening photos if the color is on grey or less. It is also useful for removing a color tint from a photo. If you create a layer that is the color of the tint you wish to remove - such as a pale blue, for scenes that are too cool in color temperature - Divide mode will return that color to white in the resulting composite, as any value divided by itself equals 1.0 (white).
This blend mode simply adds pixel values of one layer with the other. In case of values above 1 (in the case of RGB), white is displayed. "Linear Dodge" produces the same visual result. Since this always produces the same or lighter colors than the input it is also known as 'plus lighter'. A variant subtracts 1 from all end values, with values below 0 becoming black; this mode is known as 'plus darker'.
This blend mode simply subtracts pixel values of one layer with the other. In case of negative values, black is displayed.
Difference subtracts the bottom layer from the top layer or the other way round, to always get a positive value. Blending with black produces no change, as values for all colors are 0. (The RGB value for black is 0,0,0.) Blending with white inverts the picture.
One of the main utilities for this is during the editing process, when it can be used to verify alignment of pictures with similar content. Exclusion is a very similar blend mode with lower contrast.
Darken Only creates a pixel that retains the smallest components of the foreground and background pixels. If the foreground pixel has the components r1, g1, and b1, and the background has r2, g2, b2, the resultant pixel is
Lighten Only has the opposite action of Darken Only. It selects the maximum of each component from the foreground and background pixels. The mathematical expression for Lighten Only is
Boolean arithmetic blend modes
Rarely, applications such as Aviary's Peacock will supply boolean arithmetic blend modes. These combine the binary expansion of the hexadecimal color at each pixel of two layers using boolean logic gates. The top layer's alpha controls interpolation between the lower layer's image and the combined image.
Hue, saturation and luminosity
Photoshop’s hue, saturation, color, and luminosity blend modes are based on a color space with dimensions that the article HSL and HSV calls hue, chroma, and luma. Note that this space is different from both HSL and HSV, and only the hue dimension is shared between the three; see that article for details.
Unlike all of the previous blend modes described, which operate on each image channel independently, in each of these modes, some dimensions are taken from the bottom layer, while the remainder are taken from the top layer. Colors which end up out of gamut are brought inside by mapping along lines of constant hue and luma. This makes the operations uninvertible – after a top layer has been applied in one of these blend modes, it is in some cases impossible to restore the appearance of the original (bottom) layer, even by applying a copy of the bottom layer in the same blend mode above both.
- The Hue blend mode preserves the luma and chroma of the bottom layer, while adopting the hue of the top layer.
- The Saturation blend mode preserves the luma and hue of the bottom layer, while adopting the chroma of the top layer.
- The Color blend mode preserves the luma of the bottom layer, while adopting the hue and chroma of the top layer.
- The Luminosity blend mode preserves the hue and chroma of the bottom layer, while adopting the luma of the top layer.
Because these blend modes are based on a color space which is much closer than RGB to perceptually relevant dimensions, it can be used to correct the color of an image without altering perceived lightness, and to manipulate lightness contrast without changing the hue or chroma. The Luminosity mode is commonly used for image sharpening, because human vision is much more sensitive to fine-scale lightness contrast than color contrast. See Contrast (vision).
Few editors other than Photoshop implement this same color space for their analogs of these blend modes. Instead, they typically base their blend modes on HSV (aka HSB) or HSL. Blend modes based on HSV are typically labeled hue, saturation, and brightness. Using HSL or HSV has the advantage that most operations become invertible (at least in theory), but the disadvantage that the dimensions of HSL and HSV are not as perceptually relevant as the dimensions of the space Photoshop uses.
Relation to masking
The result of applying several of these modes depends linearly on the pixel level of the top layer. In such cases, when the top layer is purely black, one gets a certain transformation of the bottom layer (which may be just a purely black or purely white image). When the top layer is purely white, one gets another such transformation. The intermediate gray values are described above using the opacity slider on the second transformation.
In such cases, applying the blending mode is equivalent to Normal blending:
- Apply two transformations to the bottom layers;
- Use the result of the first transformation as the new bottom layer;
- Put the result of the second transformation as the new top layer;
- Use the initial top layer as the mask on the new top layer.
(This assumes that the mask may be colored, with its R,G,B channels masking the channels of the image independently. Many image manipulation programs do not allow such masks; for them this equivalence holds only for grayscale top layers.)
Differences between layer and tool blending
Some applications allow the user to apply blending modes to painting tools, such as the Brush tool in Photoshop. When blending modes are used with these tools, the result is calculated based on pixels already existing on the target layer. If no pixels currently exist, then the 'painted' pixels are created as if in Normal blending mode. Subsequent strokes that overlap are then calculated based on the tool's blending mode, and the result is applied directly to the layer. A key difference with tool versus layer blending is that the results of tool blends are generally not able to be adjusted after the stroke is made, with the exception of stepping backward with the application's Undo command; layer blends may be adjusted with opacity or even switched, as they are applied dynamically between layers.
This distinction is useful to create various effects on a single layer, such as when applying dodge and burn techniques, where painting with a low opacity in screen or multiply modes allows the user to build up or reduce the results in a more organic way on a single layer.
- Alpha compositing
- Comparison of raster graphics editors
- Digital image editing
- Raster graphics
- Image processing
- "W3C: Compositing and Blending 1.0". Retrieved 9 November 2012.
- "Pegtop: overlay blend mode". Retrieved 3 November 2012.
- "Pegtop blend modes: soft light". Retrieved 3 November 2012.
- "Illusions.hu: soft light blending".[permanent dead link]
- "cairographics.org: Cairo's compositing operators". Retrieved 9 November 2012.
- "Adobe.com: PDF Blend Modes: Addendum (to the PDF Reference, fifth edition, version 1.6" (PDF). Retrieved 9 November 2009.
- "Gimp Advanced Guide - 5.6.4 The Darken Only and Lighten Only Blending Modes". Linuxtopia. Retrieved 28 March 2013.
- Paul R. Dunn, “Insight into Photoshop 7.0 Blending Modes”
- “Photoshop math with GLSL shaders”
- “Photoshop Blend Mode Math”, includes C code.
- Ron Bigelow, “Using Blend Modes in Photoshop – Part I”, a tutorial
- The gimp manual
- Blend modes in Flash
- Adobe Master transparency and blends pdf file
- Gimp and Photoshop Blending Modes visually explained and compared, parts one, two, three, and four
- JAVA demo on the image blending operator, an interactive JAVA-based image blending demo
- All the math behind photoshop compositing (including math for using alpha in complex compositions like softlight)
- Image Blending Algorithm
- Photoshop Blending Modes Cookbook for Digital Photographers (John Beardsworth, O'Reilly 2005) - External
- The Hidden Power of Blend Modes in Adobe Photoshop (Scott Valentine, Adobe Press 20132) - External