A binary image is a digital raster graphic whose pixels can only assume the two colors black and white. Each pixel can therefore be stored with one bit . The pixels are usually coded with the value 0 for black and 1 for white, but the reverse case also exists.
Binary images are mainly used
- in image processing ( edge detection , pattern recognition ),
- in newspaper printing,
- for fax machines and
- Laser printers .
The halftone process is used to convert a gray-scale image into a binary image ( color reduction ) .
Compression and file formats
A number of special compression types exist for data reduction of binary images . These include the two methods CCITT Group 3 and CCITT Group 4 , which can be used with TIFF files. These are optimized for documents that often appear in fax machines, i.e. a low level of blackening of the page and relatively few changes between two consecutive lines. In fact, these two methods are the same as those used on fax machines themselves.
There are also the standards JBIG and JBIG2 , which treat binary images, however, only as a special case of grayscale images .
Standard compression methods such as LZW or Deflate can also be applied to binary images. Usually, eight adjacent binary pixels are placed in a byte , and these packed bytes are then passed on to the compression routine. In a file format it is important to consider whether the leftmost pixel corresponds to the least significant or the most significant bit within the byte, since the order of the output of the pixels on the screen after unpacking should correspond to the original. Most file formats define this within the specification, with TIFF it can be freely defined in the header of the file.
Black and white graphic modes
Even with graphics cards with black-and-white graphics modes for displaying binary images, which are rarely used these days, the packed bytes approach is common in order not to waste graphics memory. Read or write access to individual pixels is somewhat more difficult, as you can only ever read or write to a memory location several pixel values at once.
Binarization refers to the generation of a binary image from a grayscale or a color image that has been converted to a grayscale image in an intermediate step. A simple binarization method is the threshold value method . Depending on whether the gray value of a pixel is above or below a certain threshold value, it becomes black or white. The choice of the threshold value is decisive; this does not necessarily have to be 50%. The threshold value method can be combined with dithering techniques in order to achieve the impression of smoother transitions. In order to automatically generate a meaningful threshold value for an image, the histogram of the image in question is broken down into two parts that are as equally large as possible using clustering methods such as K-Means or the IsoData algorithm. The center of these two clusters forms the threshold value we are looking for.