# Images and Channels

Images are often referred to as RGB images that use channels. Channels are a very simple idea that is easy to use.

RGB Explained

Much of how images are stored and manipulated in computers derives from the television technology that was first used to create computer graphics displays.

If we took look at our computer monitor’s display with a magnifying lens we would see that it consists of a very large number of triplets of red, green and blue dots. Depending on the monitor manufacturer they may be round dots or small squares or other shapes but there always will be triplets of red, green and blue elements. In most monitors the dots are quite large and easy to see even with a weak lens.

Images on the computer display are formed when the monitor precisely varies the brightness of the red, green and blue elements in each triplet. Because the dots are close together the human eye will fuse the three red, green and blue dots of varying brightness into a single dot that appears to be the color combination of the three levels of red, green and blue color. For those of us who missed art class in school, all colors perceived by humans can be formed by the right brightness combination of red, green and blue color. Amazing, but true!

From here on in we’ll refer to the Red, Green and Blue elements of images as "R", "G" and "B".

Images on computers are usually nothing more than a series of number triplets where each triplet of three numbers is intended to control a single triplet of R, G and B dots on the monitor. Each triplet of numbers is a single pixel. A number triplet such as 67, 228, 180 means to turn the R element up to 67 brightness, the G element to 228 brightness and the B element to 180 brightness. The result will be seen by humans as a pretty shade of green-blue color. The RGB numbers are called color values.

Image files are arranged so that there is a series of pixels in rows that correspond to the rows of tiny triplet dots on the monitor. When an image is displayed on the monitor so that each pixel triplet in the image file controls one color triplet on the monitor we say that the image is "natural size" or "100% zoom".

In most modern software packages we take for granted the ability to zoom in or zoom out of an image to see it smaller or larger than natural size. If we zoom in, our graphics software will take the RGB values in a pixel that were originally intended to control just one color triplet and will use that same value across and down as many triplets as is necessary to make the image bigger on the monitor. If we zoom out so that the image is much smaller than intended, then there will be more RGB values than there are color triplets to control. In that case our graphics software will average out the RGB pixel values to figure out what average value should be used to drive the color triplet for that spot in the image. Manifold System performs these functions automatically.

Channels

How many numbers are used to specify the color of each pixel is the number of channels each pixel has. In RGB as described above, an image has three numbers for each pixel that directly correspond to the three R, G and B elements in the computer display. Such RGB images have three channels.

When we consider that an image that is 1000 pixels wide by 1000 pixels high contains a million pixels overall, if we have three numbers for each pixel (one number each to control the R, G and B dots) that can add up to very many bytes of data. If each number is just one byte, then a one million-pixel image will take three megabytes of space. Not surprisingly, there have been many clever software schemes invented to reduce the amount of space required for an image.

A quick and dirty scheme is to use just one number for all three RGB dots. If the brightness of all three dots is at the same level, we perceive no color but just different shades of gray. Using one number per pixel in a million-pixel image reduces the size to only one megabyte, but at the price of seeing the image in shades of gray as a monochrome ("black and white") or grayscale image.

How many numbers we have per pixel is the number of channels that image has. A monochrome image that has one number per pixel has one channel. A more typical image that has three (R, G, B) numbers per pixel has three channels. Such images are called RGB images. Although images with three channels are most common because of the universal use of RGB formats in color displays, there is no reason why an image could not contain more numbers per pixel for a greater number of channels than three.

For example, images used in sophisticated graphics editing use four channels: three channels for RGB plus an extra alpha or "a" channel. The alpha number says how transparent that particular pixel is supposed to be when it is combined in layers with other images. Such images are called RGBa images. Images coded with four, RGBa, channels can have regions of the image that are semi-transparent, so items in lower layers can be seen to a greater or lesser degree. Ordinary RGB images can have invisible pixels but this is a simple ON/OFF effect for each pixel. RGBa images can have a different percent transparency for each individual pixel in the image. This is called pixel transparency.

Another type of one-channel image uses a single number per pixel to specify which color in a palette of 256 colors is to be used for that pixel. See the Palettes topic for an explanation of what palettes are and how they are used. For the purposes of channels, it is important to note that images that use palette images are one channel images. This one channel is then expanded into three numbers per pixel via the palette.

Images collected by satellite sensors can contain hundreds of channels per pixel, with each channel being a number that represents some special quality collected by that sensor. Channels might code the height of that pixel, the temperature as seen from space or the reflectance as seen in various spectral bands invisible to human eyes. Since computer monitors only have three, RGB elements for each pixel, showing such multi-channel images requires software that maps the many channels into only three for display purposes. Such multi-channel images are often displayed using "false color" techniques that map one or more channel values into a specific range of RGB values.

There are two ways of working with multi-channel images such as multi-spectral satellite raster data images. First, such images may be stored as .ecw images and imported into Manifold as multi-channel compressed images . Channels from the compressed image may then be assigned to R, G, B and Alpha channels using the View - Display Options dialog. An alternate technique is to import multi-spectral images from non-.ecw formats into Manifold as multiple grayscale images where each image represents one channel. The grayscale images may then be combined three at a time to create false color RGB images or analyzed with scripts that can work with multiple images (in this case representing multiple channels) at once.

Channel Controls

When working with photographic images it is often very convenient to manipulate just one channel at a time. For example, if a photograph was taken outdoors without a blue sky filter the overall image may appear too blue. In that case, it would be very convenient just to see the blue channel and to turn down the "blue" intensity overall to get a more natural-looking image.

When used with images, the Layers pane (pop open from the View - Panes menu) will automatically display all the channels in whatever image has been opened. Click the checkboxes to turn channels off and on. Any editing effects will be applied to only those channels that are checked on and when painting into the image only those channels which are enabled will get painted.

The layers pane will show one channel for grayscale and palette images, three channels for RGB images and four channels for RGBa images. The layers pane also provides checkboxes to draw a background as well as a border around the image. See the Layers pane topic for more information on the border and background checkboxes.

Using all three channels shows the image in natural color.

Using no channels results in no visible image.

Checking just the Red channel shows the image using only the red dots on our monitor.

Checking Green only uses only the green dots. Note that the region of blue sky has darker red and green tones because it is predominately blue in appearance. The white clouds are bright in all three channels because simultaneous brightness in R, G, and B results in white.

Checking Blue uses only the blue dots. If we have a photograph shot outdoor with a sky filter correction it may end up too blue. To provide a more natural appearance, we might reduce the brightness of all blue tones to make the photograph less blue.

Using two channels together results in "combined" colors as used in the printing industry. For example, Blue and Red together are Magenta.

Blue and Green together are Cyan.

Green and Red together are Yellow (surprisingly!). Keep in mind when mixing RGB channels we are mixing light, not paint. Mixing green and red paint together results in mud, but mixing red and green light together results in yellow.

Commands use Visible Channels

All Manifold image commands work only on those channels that are enabled. For example, changing Brightness in an image with the Red and Green channels unchecked and only the Blue channel visible will affect the brightness of the Blue color value numbers only.

To make an image more or less yellow, check the Green and Red channels ON and the Blue channel OFF and increase or decrease brightness.

Likewise, painting into an image paints color values only into those channels that are checked ON. See the Painting within Channels topic for details.

Saving Channels as Separate Images

At any time we can save the separate channels of an RGB or RGBa image as different grayscale images. To do so, we use the Edit - Save Mask/Channel command with the channel to be saved specified in the dialog's Save box.

See the Masks topic for a discussion on how Edit - Save Mask/Channel can be used to separate an image into different images for each channel.