Alphas Made Transparent

Alpha channels – never heard of them? Sounds like something out of a science fiction movie or maybe a special package available from your cable provider. The truth is – if you’re a digital video editor, you’re probably going to need to use alpha channels at some point in your career. Simply put, alpha channels are what allow digital video editing systems to use variable transparency to composite multiple video layers. While this sounds like a straightforward concept, alphas are a notorious stumbling block for those who don’t understand them. Let’s take a look at how alphas work, to help clarify some popular misconceptions, as well as eliminate unnecessary headaches during your video projects.

Bits and Pixels

Before we dive headfirst into understanding alphas, it’s best that we take two steps back to discuss some basic concepts involving digital images. It’s doubtful most video editors aspire to become computer geeks, but it’s certainly helpful to understand the fundamental ideas driving the technology you use.

Let’s start by reviewing binary information. Using binary, all digital information receives a value of either 0 or 1 (sometimes referred to as being "off" or "on"). A single 0 or 1 represents one bit of information in a computer. Strings of these individual bits are what make up bytes, megs and gigs of information – terms most of us are very familiar with.

How does this apply to alpha channels? In the world of digital video and computer monitors, images have a varying range of color depth. Color depth refers to the amount of digital information used to create an image’s color. For example, 24-bit color depth displays up to 16.8 million colors, referred to as true color since it roughly displays all of the colors discernable to the human eye.

Another term often associated with digital images is the pixel. Pixels are the smallest segment of an image that appears on a monitor. Separating an image into its individual pixels is similar to looking at a picture through a transparent sheet of graph paper, each square of the graph being equivalent to a single pixel. More information per pixel translates into greater color depth. So, when you hear mention of 8-bit, 16-bit or 24-bit color depth, this tells you how much information (in the form of 0s and 1s) is going into creating the color of an image.

One point of clarification, however – pixels, themselves, are broken down into three or four separate channels of information. Each channel provides a specific range of the color: red channel, green channel and blue channel, from which we get the term RGB image. Nowadays, most images use 24-bit color depth, with 8-bits assigned to each of the three RGB channels of information. The fourth channel, supported only by 32-bit color depth (or greater), is what provides an image’s alpha information. 32-bit images have four channels of information: red, green, blue and alpha. You will often see 32-bit color depth referred to as "Millions of Colors+", meaning millions of colors plus the image’s alpha information.

Supporting Variable Transparency

Now you understand that when you’re working with alpha channels, you’re working with RGBA images supporting 32-bit color depth. What else do you need to know about digital images that support alpha channels? To start, only a very few image formats and video codecs support 32-bit color depth. At the consumer level, PNG and TGA image files are the most common formats with alpha channel support. Of course, video is just a long series of still images. Uncompressed video may also support an alpha channel, given enough color depth. Uncompressed video may be wrapped in a number of video formats, including QuickTime (QT) and Windows AVI file formats.

When you make a video codec selection, look for your color depth options associated with that codec. One example of a video codec that supports alpha channel transparency is the Sorenson Video 3 codec. A popular misconception is that simply selecting a file format that supports alpha channels will give you alpha channel support. If you haven’t set your color depth to 32-bit and specified an alpha channel, then all other codec and file specifications become irrelevant. Your codec needs to have the "Millions of Colors+" option available, otherwise you won’t get alpha channel support using that codec, even if the image format you’ve selected supports alpha information.

Even though you’re working with color images, the alpha information may be visible as black and white information. Black areas are (most commonly) totally transparent and white areas are totally opaque . The gray scale value in between these is what determines the level of transparency an image receives.

This variable transparency is what allows you to make different types of video effects in your projects. For example, you can use a video clip of a car, layered behind an animation supporting partial transparency, to create the illusion that the animation is playing in the windshield, while the driver and interior are still visible through the animation.

Be warned – there is one drawback with alpha channels: clips that support alpha information will always have to render when you import them to your editor’s timeline. This means that even systems boasting real-time previewing and playback won’t immediately play without first rendering an alpha clip. A few systems import and render simultaneously, giving the illusion of importing without having to render, but this is a rare feature.

Double Trouble

Think you’re getting the hang of alphas? Now I’m going to throw you a curve ball: there are two different types of alpha channels – straight and premultiplied . The good news is that everything we’ve discussed so far about color depth, pixels, codecs and file formats pertains to both kinds of alphas.

In a straight alpha format, all of the alpha information is contained solely in the alpha channel. A premultiplied alpha contains alpha information in each of the RGB channels, as well as the alpha channel (red x alpha, green x alpha, blue x alpha and alpha). Interpreting the alphas incorrectly (for example, straight as premultiplied) can have unintended results.

The most likely problem occurs when you interpret a premultiplied as a straight alpha. When this happens, a black or white halo appears around the edge of your images. On the other hand, images with straight alphas incorrectly interpreted as premultiplied, appear brighter than they should.

Key to Success

Another misconception about video that supports alpha channels is that the alpha areas automatically become transparent when you import them into your editing system. Some will automatically detect the right setting and some won’t. Don’t be alarmed when you import an alpha image that isn’t immediately transparent.

With many applications, when you import an alpha element, you’ll notice that the transparent area is filled in black – that’s standard. What you have to do is key out the alpha information, the same way you would do a luminance key or chromakey. However, do not make the mistake of doing a luminance or chromakey to remove alpha information. Sure, it may work (more or less), but it defeats the purpose of using an alpha in the first place and the quality will certainly suffer. Using one of these other keying methods will not only remove the alpha information, but it will also remove colors from the image that are supposed to be there. Using the incorrect keying method for your images will either make them look very jagged at the edges, or they’ll have holes throughout them where colors have been mistakenly removed. Although the correct method of keying alphas will vary slightly, depending on your editing system, the results will be the same – a clean image, with transparent areas usable to composite with your video clips.

Sidebar: Transparent GIF

While the CompuServe GIF format supports transparency, it does not support variable transparency. Instead, the GIF uses binary transparency. This means that instead of being able to control the degree of transparency, a GIF image’s pixels can be set either to an on or off value (totally transparent or opaque). By contrast, file formats that support alpha channels allow 256 possible transparency settings – totally transparent, totally opaque and variable degrees of gray between these two extremities.

The Videomaker Editors are dedicated to bringing you the information you need to produce and share better video.

Related Content