Color
space support, image manipulation and dithering
methods in the Document Imaging SDK
Every
image processing toolkit must provide tools
to convert images from one format to another,
and these image conversions can be grouped
into multiple categories. These categories
are: file format conversions, which change
the way that image data is encoded and saved
into a file; and color space conversions, which
change the way that colors are represented.
In addition to these conversion methods, image-processing
toolkits must provide tools that change different
attributes of a given image.
All
the above functionality is included in the
Black Ice Document Imaging SDK and the Image
SDK. The following article will focus specifically
on color space support, color manipulation
and dithering functionality.
Color space
support: Today’s devices represent
colors in many different ways. Some devices,
like display devices, work with the RGB color
space. Other devices such as printers may
use the CMYK colors space. The Document Imaging
SDK/ActiveX has over 60 functions, which
can be grouped into three sets of functions.
There is a group of function to convert a
Device Independent Bitmap, a buffer or a
single pixel to and from any of the supported
color spaces. Black Ice Document Imaging
SDK and Image SDK currently support the following
9 color spaces: RGB, CMY, CMYK, HIS, HSV,
L*a*b, XYZ, YIQ, YUV.
Color manipulation
and dithering: Color manipulation
methods change the appearance of an image
by changing basic characteristics of the
image such as contrast, brightness, hue,
saturation, etc. Dithering methods modify
the number of bits that stores the color
of a pixel. The most common way to represent
the color of a pixel is by using 24 bits
(3 bytes) of information. The first byte
(8 bits) stores the red component, the second
stores the green component and the third
byte stores the blue component. This method
produces very good results but 24 bit images
are very large. Other images store the color
of each pixel in less the 3 bytes. As the
number of bytes per pixel is reduces the
image size will be smaller but the color
reproduction will also be reduced. If the
number of bits that represent a pixel goes
down to one, then every pixel of the image
can be either white or black. These images
are monochrome images and are widely used
in faxing.
Two
colors are sufficient for most office documents
when the image contains text only. There is
a bigger problem when documents contain charts,
drawings, photos etc. Because there are more
colors in the document than a monochrome image
could represent there was a need to find a
solution to represent many shades of colors
by a combination of black and white pixels
only. These methods are named dithering methods
and they represent colors by changing the density
of black pixels in a given area.
The
Black Ice Document Imaging SDK and Image SDK
provide numerous color manipulation and dithering
functions. In addition to basic brightness,
contrast, hue and saturation manipulation functions,
the Document Imaging SDK also includes more
sophisticated features like automatic contrast,
level and color adjustment function which analyze
the image and set the contrast and other parameters
of the image automatically.
In
addition to the color manipulation functions
the Black Ice Document Imaging SDK and Image
SDK includes 9 dithering methods. Some of these
methods are only available from Black Ice Software.
These methods are the following: Floyd-Steinberg,
Jarvis-Judice-Ninke, Sharp, Smooth, Stucki,
Burkes, Sierra, Stevenson Arce and Ordered
dithering. These methods produce fast and spectacular
results. The following image shows the original
image and the result of the Stevenson Arce
dithering.