Alpha compositing

Alpha blending is a technique in image or video editing, are superimposed in different images into one large image, with in addition to the color information and the alpha channel is considered.

The alpha value of a pixel (pixel ) is a measure of the transparency or opacity. An α value of 0 stands for complete transparency, the pixel is invisible. An α of 1 represents complete opacity, pixel overlaid all pixels behind him.

Calculation

Did they give two colors A and B and A would like to put on B, one uses the following equation to get the new value for the non-transparent final color C:

.

An expression of the form is also called a convex combination.

Thus, it is possible to convert a RGBA in an RGB value, without the α - channel simply cut off.

For example, a transparent purple ( 0.5,0,1,0.75 ) on a white background (1,1,1 ) then yields ( 0.625,0.25,1 ).

For crossfading two transparent colors, however, the Porter Duff algorithm is suitable. Here, the final color C is calculated to

And transparency of the final color is determined by

This is equivalent to A over B operation in the picture. This algorithm is used in the PDF and SVG formats.

In some raster graphic formats can assume α only the values ​​0 or 1. In this case, a pixel is therefore either completely invisible or fully opaque. The GIF format is one example.

In addition to this type of calculation you can still combine the colors A and B in another way. Thus the different effects can be achieved. One could calculate the difference of the color values ​​, for example, A show only where the α - value of B is not 0, etc.

Areas of application

Image

A major application of the alpha blending is the picture composition: As with a photomontage an object should be cut out of an image and pasted into a new image. To this end, the alpha channel of the image with the cut out image needs to be edited accordingly. If you cut the object with conventional methods, the transparency can not be taken into account. Instead, you set a corresponding alpha value for each pixel. Placing the alpha channel graphically, by interpreting the values ​​as shades of gray between black and white, one obtains the so-called alpha matte. The creation of this mask is called " Pulling the mat " or Matting. Until recently, you had to largely create the mat by hand, as no efficient algorithms with satisfactory results were available. The SIGGRAPH Conferences of 2004 and 2005, however, presented promising approaches such as Bayesian and Poisson Matting Matting.

Most image editing programs like GIMP or Photoshop support the separate processing of the alpha channel on layer masks. So you can directly edit with the well-known painting tools the transparency of an object.

Computer Graphics

Alpha blending is used in computer games and other graphics applications to model the transparency properties of objects. So a tinted window glass would be stored and displayed just as a colored area with low α. For this, the first completely opaque object is first searched in the viewing area. From this, the above- presented convex combination is successively formed with the color values ​​of other objects now. With High Color is a maximum of 1 bit for the alpha channel available in True Color is 8 bit.

See also: Blending

51628
de