Lectures on Digital Color,  M. Goldman

Physics 1230,  Light and Color, Fall 2003

VII                Compression of bitmapped images

c        RLE lossless compression (e.g, TIFF)

4In the table below, there is a run of zeros of run length 5, a run of 128's of run length 4, and a run of 37's of run length 4.

 0 0 0 0 0 32 84 128 128 128 128 96 74 56 32 32 32 32

o           The pixel carrying run length information is specified below by a grey cell with a value given by a red number for the run length.Such a value is called a run-lengthtoken..

Ÿ         An 8th bit with value one could be used to indicate that the number given by the first 7 bits is a run-length token rather than a code for a color. In reading the comp­ressed file, the 8th bit would be ignored in the value of the next pixel, which gives the color value to be repeated.

 5 0 32 84 4 128 96 74 56 4 32

o           Below, we have represented this kind of token as a blue number (2) in a grey background.The value 2 means that 2 non-repeating pixels will follow.

Ÿ         In the example below, the following pixels, would be read without paying attention to their 8th bit, followed by the next marker, which would have 1 as the 8th bit, indicating that the following value (128) is to be repeated 4 times.

 5 0 2 32 84 4 128 3 96 74 56 4 32

o           In a graphics program, such as Photoshop, the sequence is re-expanded according to the coded information, and shown below.Note, we have color-coded the repeated pixels differently from the non-repeating pixels.

 0 0 0 0 0 32 84 128 128 128 128 96 74 56 32 32 32 32

VIII           Processing bitmapped images

b       How to make an image sharper.

3Sharpening is carried out using a mathematical rule or "filter" which changes the pixels to emphasize edges and increase contrast.

o           Consider the following sequence of pixel values representing a sharp pixel transition:

 2 2 2 2 2 4 6 6 6 6 6

o           Now we will apply the following filter to this sequence

 -1 2 -1

o           The rule is, that whatever pixel value is centered above the red 2 is the pixel we are changing.The new value of this pixel is obtained by multiplying corresponding numbers and adding.

Ÿ         For example, in the above position, the filter gives -1 x 2 + 2 x 2 + -1 x 2 = 0, so the filter in this position changes the green 2 into a 0

 2 0 2 2 2 4 6 6 6 6 6

o           Next, we simply step the filter across the sequence of original pixel values, changing as we go along:

 2 2 2 2 2 4 6 6 6 6 6 -1 2 -1

o           This yields a new value for the third pixel:

 2 2 0 2 2 4 6 6 6 6 6

o           Stepping across the entire sequence gives the new set of pixel values:

 0 0 0 0 -2 0 +2 0 0 0 0

o           Adding these "enhancements" to the original sequence gives

 2 2 2 2 0 4 8 6 6 6 6