Blend modes
   HOME

TheInfoList



OR:

Blend modes (alternatively blending modes or mixing modes) in digital
image editing Image editing encompasses the processes of altering images, whether they are digital photographs, traditional photo-chemical photographs, or illustrations. Traditional analog image editing is known as photo retouching, using tools such as a ...
and
computer graphics Computer graphics deals with generating images with the aid of computers. Today, computer graphics is a core technology in digital photography, film, video games, cell phone and computer displays, and many specialized applications. A great de ...
are used to determine how two
layers Layer or layered may refer to: Arts, entertainment, and media * ''Layers'' (Kungs album) * ''Layers'' (Les McCann album) * ''Layers'' (Royce da 5'9" album) *"Layers", the title track of Royce da 5'9"'s sixth studio album * Layer, a female Maveri ...
are blended with each other. The default blend mode in most applications is simply to obscure the lower layer by covering it with whatever is present in the top layer (see
alpha compositing In computer graphics, alpha compositing or alpha blending is the process of combining one image with a background to create the appearance of partial or full transparency. It is often useful to render picture elements (pixels) in separate pas ...
); because each
pixel In digital imaging, a pixel (abbreviated px), pel, or picture element is the smallest addressable element in a raster image, or the smallest point in an all points addressable display device. In most digital display devices, pixels are the ...
has numerical values, there also are many other ways to blend two layers. Most graphics editing programs, such as
Adobe Photoshop Adobe Photoshop is a raster graphics editor developed and published by Adobe Inc. for Windows and macOS. It was originally created in 1988 by Thomas and John Knoll. Since then, the software has become the industry standard not only in rast ...
and
GIMP GIMP ( ; GNU Image Manipulation Program) is a free and open-source raster graphics editor used for image manipulation (retouching) and image editing, free-form drawing, transcoding between different image file formats, and more specialized ...
, allow users to modify the basic blend modes, for example by applying different levels of opacity to the top "layer". The top "layer" is not necessarily a layer in the application; it may be applied with a painting or editing tool. The top "layer" also is called the "blend layer" and the "active layer". In the formulas shown on this page, values go from 0.0 (black) to 1.0 (white).


''Normal'' blend mode

This is the standard blend mode which uses the top layer alone, without mixing its colors with the layer beneath it: f(a, b) = b where ''a'' is the value of a
color channel Color digital images are made of pixels, and pixels are made of combinations of primary colors represented by a series of code. A channel in this context is the grayscale image of the same size as a color image, made of just one of these primary ...
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 In computer graphics, alpha compositing or alpha blending is the process of combining one image with a background to create the appearance of partial or full transparency. It is often useful to render picture elements (pixels) in separate pas ...
(making the actual formula f(a, b) = alpha(b, a)), 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.


Dissolve

The dissolve mode takes random pixels from both layers. With top layer opacity greater than that of the bottom layer, most pixels are taken from the top layer, while with low opacity most pixels are taken from the bottom layer. No
anti-aliasing Anti-aliasing may refer to any of a number of techniques to combat the problems of aliasing in a sampled signal such as a digital image or digital audio recording. Specific topics in anti-aliasing include: * Anti-aliasing filter, a filter used be ...
is used with this blend mode, so the pictures may look grainy and harsh.
Adobe Photoshop Adobe Photoshop is a raster graphics editor developed and published by Adobe Inc. for Windows and macOS. It was originally created in 1988 by Thomas and John Knoll. Since then, the software has become the industry standard not only in rast ...
generates a pseudo-random noise dither pattern on startup, with each pixel location in a 2D raster array assigned a gray value (R=G=B) and an alpha value of 1 ("on"). As the opacity of the top layer is reduced, the alpha value of some of the gray pixels is switched from 1 to 0 ("off"), with the result that image pixels corresponding to a gray-valued pixel in the raster array are either on (visible, opaque) or off (invisible, 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 many combinations of them, such as Overlay, Soft Light (''see below''), Vivid Light, Linear Light, and Pin Light.


Multiply

Multiply blend mode takes the RGB channel values from 0 to 1 of each pixel in the top layer and multiples them with the values for the corresponding pixel from the bottom layer. Wherever either layer was brighter than black, the composite is darker; since each value is less than 1, their product will be less than each initial value that was greater than zero. f(a,b) = ab, where ''a'' is the base layer value and ''b'' is the top layer value. This mode is ''commutative'': 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 In mathematics, a curve (also called a curved line in older texts) is an object similar to a line, but that does not have to be straight. Intuitively, a curve may be thought of as the trace left by a moving point. This is the definition that ...
, or
gamma correction Gamma correction or gamma is a nonlinear operation used to encode and decode luminance or tristimulus values in video or still image systems. Gamma correction is, in the simplest cases, defined by the following power-law expression: : V_\tex ...
with γ=2. For image editing it is sometimes more convenient to simply go to the Curves dialog of the software, because it gives more flexibility in the shape of the curves. Or one can use Levels dialog: the middle number is usually 1/γ, so one can just type 0.5. If one layer contains a homogeneous color, such as the gray color (0.8, 0.8, 0.8), multiply blend mode is equivalent to a curve that is simply a straight line. This is also equivalent to using this gray value as opacity when doing "normal mode" blend with a black bottom layer.


Screen

With Screen blend mode, the values of the pixels in the two layers are inverted, multiplied, and then inverted again. The result is the opposite of Multiply: wherever either layer was darker than white, the composite is brighter. f(a,b) = 1 - (1 - a)(1 - b), where ''a'' is the base layer value and ''b'' is the top layer value. This mode is ''commutative'': 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. File:Blend modes 1.-top-layer.jpg, Example top layer File:Blend modes 2.-bottom-layer.jpg, Example bottom layer File:Blend modes 4.-multiply.jpg, ''Multiply'' blend mode applied to the two example layers File:Blend modes 5.-screen.jpg, ''Screen'' blend mode applied to the two example layers


Overlay

Overlay combines Multiply and Screen blend modes. Where the base layer is light, the top layer becomes lighter; where the base layer is dark, the top becomes darker; where the base layer is mid grey, the top is unaffected. An overlay with the same picture looks like an S-curve. f(a,b) = \begin 2 a b, &\mbox a < 0.5 \\ 1 - 2 ( 1 - a ) ( 1 - b ), &\mbox \end 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

Hard Light is also a combination of Multiply and Screen. 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

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. 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 Gamma correction or gamma is a nonlinear operation used to encode and decode luminance or tristimulus values in video or still image systems. Gamma correction is, in the simplest cases, defined by the following power-law expression: : V_\tex ...
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: f_(a,b) = \begin 2 a b + a^2 (1 - 2 b), &\mbox b < 0.5 \\ 2 a (1 - b) + \sqrt (2 b - 1), &\mbox \end 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). Pegtop's formula is smoother and corrects the discontinuity at ''b'' = 0.5: f_(a,b) = (1-2b)a^2 + 2ba. This is a linear interpolation between Multiply (for ''a''=0) and Screen (for ''a''=1) blend modes. It can also be seen as a linear interpolation between the 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.) A third formula defined by illusions.hu corrects the discontinuity in a different way, doing gamma correction with γ depending on ''b'': f_(a, b) = a^ 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. The formula specified by recent W3C drafts for
SVG Scalable Vector Graphics (SVG) is an XML-based vector image format for defining two-dimensional graphics, having support for interactivity and animation. The SVG specification is an open standard developed by the World Wide Web Consortium s ...
and
Canvas Canvas is an extremely durable plain-woven fabric used for making sails, tents, marquees, backpacks, shelters, as a support for oil painting and for other items for which sturdiness is required, as well as in such fashion objects as handbag ...
is mathematically equivalent to the Photoshop formula with a small variation where b≥0.5 and a≤0.25: f_(a, b) = \begin a - (1 - 2 b) \cdot a \cdot (1 - a) & \text b \leq 0.5 \\ a + (2 b - 1) \cdot (g_(a) - a) & \text \end where: g_(a) = \begin ((16 a - 12) \cdot a + 4) \cdot a & \text a \leq 0.25 \\ \sqrt & \text \end. This is also the formula used by
Cairo Cairo ( ; ar, القاهرة, al-Qāhirah, ) is the capital of Egypt and its largest city, home to 10 million people. It is also part of the largest urban agglomeration in Africa, the Arab world and the Middle East: The Greater Cairo metr ...
, and in earlier
PDF Portable Document Format (PDF), standardized as ISO 32000, is a file format developed by Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, hardware, and operating systems. ...
documentation. 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 Dodging and burning are terms used in photography for a technique used during the printing process to manipulate the exposure of select areas on a photographic print, deviating from the rest of the image's exposure. In a darkroom print from a fi ...
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 Clipping may refer to: Words * Clipping (morphology), the formation of a new word by shortening it, e.g. "ad" from "advertisement" * Clipping (phonetics), shortening the articulation of a speech sound, usually a vowel * Clipping (publications) ...
of highlights. (The clipping happens in the same area as for the Linear Dodge.) When the top layer contains a homogeneous color, this effect is equivalent to changing the
white point A white point (often referred to as reference white or target white in technical documents) is a set of tristimulus values or chromaticity coordinates that serve to define the color "white" in image capture, encoding, or reproduction. Depending ...
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 the top layer contains a homogeneous color, this effect is equivalent to changing the output black point to this color, and (input)
white point A white point (often referred to as reference white or target white in technical documents) is a set of tristimulus values or chromaticity coordinates that serve to define the color "white" in image capture, encoding, or reproduction. Depending ...
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. File:Blend modes 5.-screen.jpg, ''Screen'' blend mode applied to the example pictures File:Blend modes 7.-colordodge.jpg, ''Color Dodge'' blend mode applied to the example pictures File:Blend modes 8.-lineardodge.jpg, ''Linear Dodge'' (''Additive'') blend mode applied to the example pictures * 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 the 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 applies to darker values. The middle gray is the neutral color. When the top layer's 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. (This increases the perceived contrast.) * Linear Light: this blend mode combines Linear Dodge and Linear Burn (rescaled so that neutral colors become middle gray). Dodge is applied when the value on the top layer is lighter than middle gray, and burn applies when the top layer value is darker. The calculation simplifies to the sum of the bottom layer and twice the top layer, subtract 1. This mode decreases the contrast. * 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


Divide

This blend 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).


Addition

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'.


Subtract

This blend mode simply subtracts pixel values of one layer with the other. In case of negative values, black is displayed. In some applications such as
Krita Krita ( ) is a free and open-source raster graphics editor designed primarily for digital art and 2D animation. The software runs on Windows, macOS, Linux, Android, and ChromeOS, and features an OpenGL-accelerated canvas, colour management su ...
, "Inverse Subtract" is also available.


Difference

Difference subtracts the bottom layer from the top layer or the other way around, to always get a non-negative value. Blending with black produces no change, as values for all colors are 0. (The
RGB The RGB color model is an additive color model in which the red, green and blue primary colors of light are added together in various ways to reproduce a broad array of colors. The name of the model comes from the initials of the three addi ...
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

''Darken Only'' creates a pixel that retains the smallest components of the foreground and background pixels. If the foreground pixel has the components , and the background has , the resultant pixel is: min(r_1, r_2), \min(g_1, g_2), \min(b_1, b_2)


Lighten Only

''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: max(r_1, r_2), \max(g_1, g_2), \max(b_1, b_2)


Boolean arithmetic blend modes

A few applications, such as Aviary's Peacock and KDE's Krita, 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 hue, chroma and luma dimensions. Note: this space is different from both HSL and HSV, and only the hue dimension is shared between the three. See the 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 Lightness is a visual perception of the luminance (L) of an object. It is often judged relative to a similarly lit object. In colorimetry and color appearance models, lightness is a prediction of how an illuminated color will appear to a stan ...
, and to manipulate lightness contrast without changing the hue or chroma. The Luminosity mode is commonly used for
image sharpening Image editing encompasses the processes of altering images, whether they are digital photographs, traditional photo-chemical photographs, or illustrations. Traditional analog image editing is known as photo retouching, using tools such as ...
, because human vision is much more sensitive to fine-scale lightness contrast than color contrast. (See
Contrast (vision) Contrast is the contradiction in luminance or colour that makes an object (or its representation in an image or display) distinguishable. In visual perception of the real world, contrast is determined by the difference in the color, colour and ...
) 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 or any painting tools in GIMP. 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 blending 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. Put differently, painting tools alter the pixels on a layer; blend modes applied to two layers don't alter any pixels, but only affect the resulting visual image. 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.


See also

* Alpha to coverage *
Comparison of raster graphics editors Raster graphics editors can be compared by many variables, including availability. List General information Basic general information about the editors: creator, company, license, etc. Operating system support The operating systems ...
*
Raster graphics upright=1, The Smiley, smiley face in the top left corner is a raster image. When enlarged, individual pixels appear as squares. Enlarging further, each pixel can be analyzed, with their colors constructed through combination of the values for ...
*
Digital image processing Digital image processing is the use of a digital computer to process digital images through an algorithm. As a subcategory or field of digital signal processing, digital image processing has many advantages over analog image processing. It allo ...


References

{{Reflist * Paul R. Dunn
"Insight into Photoshop 7.0 Blending Modes"

"Photoshop math with GLSL shaders"

"Photoshop Blend Mode Math"
includes C code. * Ron Bigelow

a tutorial




Adobe ''Master transparency and blends'' pdf file
* GIMP and Photoshop Blending Modes visually explained and compared, part
onetwothree
an
four


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
Books
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 Digital photography Image processing