Let’s Get Technical
compression provides better
compression, in general, than the
lossless compression used in GIF
files, with little noticeable effect on
image quality. Some images look
very poor when saved and viewed as
GIF files due to the lack of colors
available.
For others, the lossy format of
the JPG is unacceptable. This is
especially true for medical images,
where the actual shade or color of a
pixel is important. In the lossy-compressed JPG image, eight-by-eight blocks of pixels have
their values adjusted slightly, so
the original content of some pixels
are lost.
Consider the image shown in
Figure 2. The image contains 190 ×
128 or 24,320 pixels. Without
compression, a total of 24,320 bytes
would be needed to store all the eight-bit pixel values for an image of 256
colors and 72,960 bytes would be
required for an image with 24-bit pixel
values.
Examine Table 2, which shows
the results of saving the image in GIF
and JPG formats. Both formats
require fewer than the 24,320 byte,
uncompressed, eight-bit color file
size. The JPG compression is clearly
superior to the GIF compression;
however, the JPG image file requires
less than half the space of the GIF
image file and only one seventh of
the estimated 72,960 bytes for an
uncompressed, 24-bit color file.
Viewing each image side by side also
illustrates why JPEG is the better
format for high quality images. The
JPG image contains almost 80
times the number of colors as the
GIF image.
So, we have seen that there are
lossy and lossless compression
techniques and that there are
applications for both methods.
Next time, we will examine some
specific compression techniques,
including run-length coding, Huffman
coding, the LZW algorithm, and
sequence coding (all lossless), as well
as the Discrete Cosine Transform
(which is used within the JPG’s lossy
compression algorithm). NV
About the Author
James Antonakos is a Professor in
the Departments of Electrical
Engineering Technology and Computer
Studies at Broome Community
College. He has over 28 years of
experience designing digital and analog
circuitry and developing software.
He is also the author of numerous
textbooks on microprocessors, programming, and microcomputer
systems. You may reach him at anton
akos_j@sunybroome.edu or visit his
website at www.sunybroome.edu/
~antonakos_j
SEPTEMBER 2004
25