Bitmaps   page 4   


The Alpha Channel

RGB colours are also called RGB channels. The reason for this is that there is an optional fourth channel a pixel can have, namely its alpha channel.

The alpha channel ('A') is used to represent transparency. Not all digital images have transparency information. In cases where they don't, (a plain RGB image), the images are 100% "solid". If you were to layer such an image over another image, it would obscure the one underneath as it is completely opaque. When an image has transparency information in it, it is often referred to as an RGBA image and this type of image is very useful in compositing work as the edges of images which overlap are nicely antialiased.

Not all image file types support transparency. The most commonly encountered general use ones are: TIFF, TGA, PNG. Photoshop PSD files are a special case.

In a 24 bit image, there are 8 bits per channel/colour, which is the same as saying that each channel/colour has 256 possible shades. The same will apply to the alpha channel. It too will be 8 bits hence have 256 shades from 0 = transparent, to 255 = opaque. The shades in between are degrees of transparency.
With the addition of an 8 bit alpha channel, bitmaps of this type become 32 bits per pixel. This type of image is often described as having embedded transparency.

Whilst you will likely encounter 64 bits per pixel images or even higher, you will almost never encounter images with alpha channels that have less than 32 bits per pixel with the exception of GIF bitmaps.

GIF images are unique in that they can have up to 256 colours (= 8 bits) plus 1 bit for transparency. 1 bit = 2. It means that there can only be two states for a GIF's alpha channel, on or off; that is, totally transparent or totally opaque - this makes them of very limited use to us in animation. If you composite using a GIF, the result is not antialiased and the result will look like the last image on page 3.

Premultiplied versus "Straight" Alpha

As a rule, using alpha channel is by far the easiest way of layering images one over another. The only downside is that there are two ways in which alpha channels can be written to a file: premultiplied and "straight".

Unfortunately, you may well encounter premultiplied alpha as it is the way that Photoshop composites layers of images, whereas most dedicated compositing programs such as After Effects, Combustion and so on are happier with "straight" or non premultiplied alpha.
Put as simply as possible: with premultiplied alpha, the actual colours of a foreground image are blended into the background colour as well as the alpha channel blending from opaque to transparent. In a straight alpha foreground image, the alpha channel still blends from opaque to transparent but the other channels, (the RGB colours), are left untouched.

Ignoring the technical explanation, all you need to know is that if you import an image to layer over another and you get very odd fringing effects where you were expecting a seamless blend, you are using the wrong sort of alpha information. Fortunately, most "high end" programs will quickly convert the image to the right sort. Almost always, you will be trying to use a premultiplied image where a straight one is needed. If it is the other way round, instead of bad fringing, you will get more subtle but unexpected changes in brightness.

Wherever possible, use "straight" alpha where a choice is offered.

 

 page 5         "Pixels and Pegbars" contents             home