CH - 3 - Handling Image - Color Palet & Compression Techniques
CH - 3 - Handling Image - Color Palet & Compression Techniques
Design
Multimedia Element II - Images
Monochrome Image
Benefits
• Small image size
• Viewable from the internet
• Uses millions of colors
• Perfect for most images
Downfalls
• High compression loses quality
• Every time a JPEG is saved, it loses more and more of
the picture
Common JPEG’s Compression
• Common JPEG's compression (known as DCT - Discrete Cosine
Transform) cuts the pixels into blocks of 64 (8x8) and processes
each block independently, shifting and simplifying the colors so
there is less information to encode.
• Pixels are changed only in relation to the other pixels within their
block
– two identical pixels that are next to each other, but in different blocks, could
be transformed in different ways.
• Consequently, when high compression is used, the block boundaries
become obvious, causing the 'blockness' or 'blocking artefact'
frequently observed in the common JPEG.
JPEG 2000 Compression
• JPEG 2000's wavelet compression processes much larger
areas of the image at once - sometimes the whole image.
• This avoids any blocking.
• The wavelet compression is also able to make a distinction
between significant detail in the image, like edges, and less
significant areas, for example, where there are slight
variations in the color.
• At very high compression JPEG 2000 will still introduce
artefacts (visible distortion in the image), but by concentrating
its compression on the less significant parts it gives much
better overall quality than a JPEG of the same file size.
A Bit On Wavelet Compression
• The advantage of wavelet compression is that, unlike the (old)
JPEG, the wavelet algorithm does not divide image into blocks,
but analyzes the whole image. It allows us to get best
compression ratio, while maintaining the quality.
Wavelet (left)
compression provides
higher quality at a ratio
of 105.6:1 while,
JPEG (right) delivers a
ratio of about 103.8 with
visible blockings in the
Wavelet compression
file size: 1861 bytes
image. JPEG compression
file size: 1895 bytes
compression ratio - 105.6 compression ratio - 103.8
Tagged Image File Format (TIFF)
• Tagged Image File Format (TIFF), stores many different types
of images (e.g., monochrome, greyscale, 8-bit & 24-bit RGB,
etc.)
• It is a computer file format for storing raster graphics images,
popular among graphic artists, the publishing industry, and
photographers.
• TIFF is a lossless format (when not utilizing the new JPEG tag
which allows for compression).
• It does not provide any major advantages over JPEG and is
not as user-controllable. It appears to be declining in
popularity.
PNG (Portable Network Graphics)
• For image editing, it provides a useful format for the
storage of intermediate stages of editing.
• Since it is lossless and supports up to 48-bit true color
or 16-bit grayscale; saving, restoring and re-saving an
image will not degrade its quality, unlike JPEG
• PNG's compression (approximately 50% in general) is
among the best that can be used without losing image
information and without paying patent fees
PNG (Portable Network Graphics)
Dancer.bmp Dancer.png
•The bitmap on the left (200 KB) and the PNG on the right (120 KB) are, in
theory, identical.
•As long as the image editor supports PNG, you can use it like a BMP.
•PNG is also an alternative when the image has to be left uncompressed.
•At least, it will be only about 50-70% the size of the bitmap.
PNG (benefits & downfalls)
Benefits
• PNG supports a large number of colors. PNG-8 (256 colors)
and PNG-24 (about 16.7 million Colors)
• Small size files.
• Minimum compression loss.
• Format is suitable for storage of intermediate versions of the
image.
– When you re-save image, quality is not lost
Downfalls
• Doesn’t support animation
• Can not store multiple images in one file
Data
Compression
Lossy and Lossless Data Compression
Methods
General Overview
Lossless Data
Compression
What is Lossless
Compression?
Run-length Encoding
Run-length encoding is probably the simplest method of
compression. It can be used to compress data made of any
combination of symbols. It does not need to know the frequency
of occurrence of symbols and can be very efficient if data is
represented as 0s and 1s.
The general idea behind this method is to replace consecutive
repeating occurrences of a symbol by one occurrence of the
symbol followed by the number of occurrences.
The method can be even more efficient if the data uses only
two symbols (for example 0 and 1) in its bit pattern and one symbol
is more frequent than the other.
Run-length Encoding example
Huffman coding
Lossy Data
Compression
What is Lossy Data
Compression?
Our eyes and ears cannot distinguish subtle changes. In such cases,
we can use a Lossy data compression method. These
methods are cheaper—they take less time and space when it comes
to sending millions of bits per second for images and video. Several
methods have been developed using Lossy compression techniques:
Temporal compression
In temporal compression, redundant frames are removed.
When we watch television, for example, we receive 30
frames per second. However, most of the consecutive
frames are almost the same.
For example, in a static scene in which someone is talking,
most frames are the same except for the segment around
the speaker’s lips, which changes from one frame to the
next.
Audio compression-MP3