This documentation is for the old version. Go to the latest Graphics Mill docs

Color Depth

Color depth is one of the most characteristic of the color stored in the computer. If color space specifies how to construct color from its components, color depth specifies how these components are stored in the computer memory. Usually color depth is measured in the number of bits used to represent one color value (pixel) - bits per pixel (bpp). The more bits a pixel occupies, the more different colors can be represented by this pixel. For example, 1-bit pixels can represent only 2 colors, 8-bit pixels - 256 color, 24-bit pixels - 16 777 216 colors (the so-called true color; researches prove that the human eyes cannot recognize more colors). On the other hand, the big color depth means that image requires more memory. Sometimes true color is not required (for example for storing documents or imagery which contains only a few colors), that's why we can greatly save memory by reducing the color depth.

Graphics Mill for .NET supports images with the following color depths:

  • 1-bit indexed (palette) images.
  • 4-bit and 8-bit indexed (palette) images.
  • 5(6) bit per channel RGB images (16 bits per pixel). Graphics Mill for .NET can only read such bitmaps and convert to other color depth. It cannot operate them anyhow else.
  • 8 bits per channel images (8, 16, 24, 32, or 40 bits per pixel, depends on the number of channels in pixel).
  • 16 bits per channel images (16, 48, 64, or 80 bits per pixel, depends on the number of channels in pixel). Bitmaps with such color depth are also called extended.

As you can notice here, colors differ not only in the number of bits per pixel, but also in the method of storage: index in the palette (i.e. indexed bitmaps) or direct color value.

Indexed images always contain a palette - a special table of colors. Each pixel is an index in this table. Usually a palette contains 256 or less entries. That's why maximum depth of indexed pixel is 8 bpp. Using palettes is a common practice when working with small color depths.

Unlike indexed images, pixels of non-indexed continuous images store actual color values instead of palette index. Each pixel consists of components (also known as channels). Channels can be interpreted differently, according to the color space of the pixel. For example, grayscale images have only one luminosity channel. RGB images have three channels - red, green, and blue. CMYK images have four channels - cyan, magenta, yellow, and black. Besides, pixels can contain extra component called alpha channel. Alpha channel does not contain any color or luminosity information, it specifies the degree of pixel opacity when it is overlayed on another image. The less alpha value is, the more transparent is the pixel.

Let's examine possible color depths of Graphics Mill for .NET in more details.

1-Bit Indexed (Palette) Images

1-bit images (also known as bitonal) can consist only of two colors. Usually these colors are black and white (however as it has a palette, you can specify any other two colors). The main benefit of bitonal images is an extremely compact size, however usually two colors are not enough. But nevertheless, there is a kind of images, where 1-bit color depth is widely used: documents, paperwork, faxes, and similar images.

In Graphics Mill for .NET such images have a Format1bppIndexed pixel format. Graphics Mill for .NET allows some basic transformations on such images (resize, flip, rotate, crop). When zooming a bitonal image, you can use special technique of resizing which preserves details and produces high quality (known as scale-to-gray).

4-Bit And 8-Bit Indexed (Palette) Images

Maximum count of 4-bit colors is 16, maximum count of 8-bit colors is 256. These color depths are used when it is necessary to store an image with small amount of colors. The typical example is web imagery - buttons, banners, logos, etc. Relatively small size makes such images ideal for web.

In Graphics Mill for .NET such images have pixel formats Format4bppIndexed and FormatbbppIndexed accordingly. For these formats Graphics Mill for .NET supports only several basic transforms and effects (rotate, resize, crop and some others).

5(6) Bit Per Channel RGB Images

These pixel format are not wide-spread nowadays, but some file formats allow to store them. Graphics Mill for .NET cannot work with pixels in this format directly, however it can load and convert them to any other pixel format.

In Graphics Mill for .NET these formats are represented by: Format16bppArgb1555, Format16bppRgb555 and Format16bppRgb565.

8 Bit Per Channel Images

These images are most popular in store photos and similar images. This color depth allows to represent as many color hues as the human eye can recognize. There are the following kinds of 8-bit per channel pixel formats supported in Graphics Mill for .NET:

  • 8 bits per pixel grayscale format (Format8bppGrayScale);
  • 24 bits per pixel RGB format (Format24bppRgb);
  • 32 bits per pixel CMYK format (Format32bppCmyk);
  • 16 bits per pixel grayscale + alpha format (Format16bppAGrayScale);
  • 32 bits per pixel ARGB format (RGB + alpha) (Format32bppArgb );
  • 32 bits per pixel RGB format (without alpha) (Format32bppRgb). Extra byte is not used, it is necessary only to align pixel to a 4-byte word (for performance reasons);
  • 40 bits per pixel ACMYK format (CMYK + alpha) (Format40bppAcmyk).

16 Bit Per Channel Images

It may seem strange, why we need more than 8 bit per channel if our eye will not notice the difference. The problem is when we apply some operations to the 8 bit per channel image (for example tone adjustment or color enhancement), some color information can be lost or distorted due roundoff errors. It is especially noticeable when we apply these operation several times. To avoid this problem, we have to increase the color depth. That's why most scanners produces 48 bpp images instead of 24 bpp. There are the following 16 bits per channel pixel formats are supported in Graphics Mill for .NET:

  • 16 bits per pixel grayscale format (Format16bppGrayScale);
  • 48 bits per pixel RGB format (Format48bppRgb);
  • 64 bits per pixel CMYK format (Format64bppCmyk);
  • 32 bits per pixel grayscale + alpha format (Format32bppAGrayScale);
  • 64 bits per pixel ARGB format (RGB + alpha) (Format64bppArgb);
  • 80 bits per pixel ACMYK format (CMYK + alpha) (Format80bppAcmyk).