Image Processing Reference
sequence. This process should already be familiar to you. We use it all the time when we
take pictures with digital still cameras and upload them as a JPEG file. GIF and TIFF
images are also examples of spatial compression. Simple video codecs just create a
sequence of still frames that are coded in this way. Motion JPEG is an example in which
every frame is discrete from the others.
The process starts with uncompressed data that describes a color value at a Cartesian
(or X-Y) point in the image. Figure 2-1 shows a basic image pixel map.
The next stage is to apply some run-length encoding, which is a way of describing a
range of pixels whose value is the same. Descriptions of the image, such as “pixels 0,0 to
100,100 are all black,” are recorded in the file. A much more compact description is shown
in Figure 2-2.
This coding mechanism assumes that the coding operates on scan lines. Otherwise it
would just describe a diagonal line.
The run-length encoding technique eliminates much redundant data without losing
quality. A lossless compressor such as this reduces the data to about 50% of the original size,
depending on the image complexity. This is particularly good for cell-animated footage.
The TIFF image format uses this technique and is sometimes called LZW compres-
sion after its inventors, Lempel, Ziv, and Welch. Use of LZW coding is subject to some roy-
alty fees if you want to implement it, because the concepts embodied in it are patented.
This should be included in the purchase price of any tools you buy.
The next level of spatial compression in terms of complexity is the JPEG technique,
which breaks the image into macroblocks and applies the discrete cosine transform ( DCT ).
This kind of compression starts to become lossy. Minimal losses are undetectable by the
human eye, but as the compression ratio increases, the image visibly degrades.
Compression using the JPEG technique reduces the data to about 10% of the orig-
Figure 2-1 Uncompressed image pixel map.