LZW CODING TECHNIQUE FOR IMAGE COMPRESSIONLZW CODING TECHNIQUE FOR IMAGE COMPRESSION
RAHUL PATHAK RENJITH R
CB.EN.P2AEL15018
CB.EN.P2AEL15020
CONTENTSCONTENTS
An overview of Image compression
Techniques for Image compression
An Introduction to LZW coding technique
Methodology (Algorithm) LZW coding
Advantages and Disadvantages of LZW coding
Applications of LZW coding
An overview of Image compressionAn overview of Image compression
 Goals of compression
a) Remove redundancy
b) Reduce irrelevance
c) Reduce storage required and hence the cost
d) Reduced bandwidth can be used
e) Reduces time to retrieve and transmit data
 Compression modes
1) Lossless compression
Preserve all information, perfectly recoverable.
2) Lossy compression
Throw away perceptually insignificant information
and cannot recover all bits
An overview of Image compressionAn overview of Image compression
 Compressed data = compress (original Data)
 Decompressed data = decompress(Compressed data)
 When original Data = decompressed data, the compression is
lossless.
 When original data != decompressed data, the compression is
lossy.
 Lossless compression is essential in applications such as text file
compression/ Medical imaging applications
 In video transmission, a slight loss in the transmitted video is not
noticed by the human eye.
 Compression ratio = original data size/compressed data size
Techniques for Image compressionTechniques for Image compression
?
An Introduction to LZW coding techniqueAn Introduction to LZW coding technique
 Lempel-Ziv-Welch (LZW) coding is the foremost technique
for general purpose data compression due to its simplicity
and versatility.
 It is invented by Abraham Lempel, Jacob Ziv, and Terry Welch
 It addresses spatial redundancies in an image
 It is an error free compression approach
 Prior knowledge of probability of occurrence of symbols to
be encoded is not required.
 Lossless compression technique
Why LZW coding?Why LZW coding?
 For most palette color images LZW yields the highest
compression efficiency without sacrificing image
data. 
 The GIF image file format is the de facto standard for
images on the web. Most GIF files use the LZW
compression.
AN EXAMPLEAN EXAMPLE
 Consider an image of size 512*512, 8 bit image.
Uncompressed TIFF Version of this image requires
286,740 bytes of disk space
 Using TIFF's LZW compression option,however,the
resulting file is 224,420 bytes.
 The compression ratio ,C= (286740 / 224420)= 1.277
 For Huffman encoded representation of the same
image achieves compression ratio, C=1.077.
 The additional compression realized by LZW approach is
due to removal of Image's spatial redundancy.
Basic Principles of LZW CodingBasic Principles of LZW Coding
 LZW coding assigns fixed length code words to variable length
sequence of input symbols.
 The coding is based on a “dictionary” or “codebook” containing the
source symbols to be encoded. The coding starts with an initial
dictionary, which is enlarged with the arrival of new symbol
sequences.
Encoding a sequence of symbols using LZW CodingEncoding a sequence of symbols using LZW Coding
 The encoding process is be illustrated for one line of image
having the following intensity values in sequence: 32 32 34
32 34 32 32 33 32 32 32 34.
 Consider the table as below:
Sequence:Sequence: 32 32 34 32 34 32 32 33 32 32 32 34.32 32 34 32 34 32 32 33 32 32 32 34.
Decoding a Lempel-Ziv encoded sequenceDecoding a Lempel-Ziv encoded sequence
Table 27-3 provides the step-by-step details for
an example input file consisting of 45 bytes, the
ASCII text
string: the/rain/in/Spain/falls/mainly/on/the/plain.
When we say that the LZW algorithm reads
the character "a" from the input file, we mean it
reads the value: 01100001 (97 expressed in 8
bits), where 97 is "a" in ASCII. When we say it
writes the character "a" to the encoded file, we
mean it writes: 000001100001 (97 expressed in
12 bits).
Advantages and disadvantages of LZW codingAdvantages and disadvantages of LZW coding
Advantages:
 Extremely effective when there are repeated patterns
in the data that are widely spread
 Prior knowledge of probability of occurrence of symbols
to be encoded is not required.
 Simple coding technique with high compression ratio.
 LZW compression is fast
 Lossless compression technique
Disadvantages:
 Creates entries in the dictionary that may never be
used.
 LZW is a fairly old compression technique
Applications of LZW codingApplications of LZW coding
LZW compression can be used in a variety of file formats:
 TIFF (tagged image file format )files
 GIF (graphic interchange format ) files
 PDF(portable document format) files
 Unix Compress, gzip.
 Suitable for compressing text files

Lzw coding technique for image compression

  • 1.
    LZW CODING TECHNIQUEFOR IMAGE COMPRESSIONLZW CODING TECHNIQUE FOR IMAGE COMPRESSION RAHUL PATHAK RENJITH R CB.EN.P2AEL15018 CB.EN.P2AEL15020
  • 2.
    CONTENTSCONTENTS An overview ofImage compression Techniques for Image compression An Introduction to LZW coding technique Methodology (Algorithm) LZW coding Advantages and Disadvantages of LZW coding Applications of LZW coding
  • 3.
    An overview ofImage compressionAn overview of Image compression  Goals of compression a) Remove redundancy b) Reduce irrelevance c) Reduce storage required and hence the cost d) Reduced bandwidth can be used e) Reduces time to retrieve and transmit data  Compression modes 1) Lossless compression Preserve all information, perfectly recoverable. 2) Lossy compression Throw away perceptually insignificant information and cannot recover all bits
  • 4.
    An overview ofImage compressionAn overview of Image compression  Compressed data = compress (original Data)  Decompressed data = decompress(Compressed data)  When original Data = decompressed data, the compression is lossless.  When original data != decompressed data, the compression is lossy.  Lossless compression is essential in applications such as text file compression/ Medical imaging applications  In video transmission, a slight loss in the transmitted video is not noticed by the human eye.  Compression ratio = original data size/compressed data size
  • 5.
    Techniques for ImagecompressionTechniques for Image compression ?
  • 6.
    An Introduction toLZW coding techniqueAn Introduction to LZW coding technique  Lempel-Ziv-Welch (LZW) coding is the foremost technique for general purpose data compression due to its simplicity and versatility.  It is invented by Abraham Lempel, Jacob Ziv, and Terry Welch  It addresses spatial redundancies in an image  It is an error free compression approach  Prior knowledge of probability of occurrence of symbols to be encoded is not required.  Lossless compression technique
  • 7.
    Why LZW coding?WhyLZW coding?  For most palette color images LZW yields the highest compression efficiency without sacrificing image data.   The GIF image file format is the de facto standard for images on the web. Most GIF files use the LZW compression.
  • 8.
    AN EXAMPLEAN EXAMPLE Consider an image of size 512*512, 8 bit image. Uncompressed TIFF Version of this image requires 286,740 bytes of disk space  Using TIFF's LZW compression option,however,the resulting file is 224,420 bytes.  The compression ratio ,C= (286740 / 224420)= 1.277  For Huffman encoded representation of the same image achieves compression ratio, C=1.077.  The additional compression realized by LZW approach is due to removal of Image's spatial redundancy.
  • 9.
    Basic Principles ofLZW CodingBasic Principles of LZW Coding  LZW coding assigns fixed length code words to variable length sequence of input symbols.  The coding is based on a “dictionary” or “codebook” containing the source symbols to be encoded. The coding starts with an initial dictionary, which is enlarged with the arrival of new symbol sequences.
  • 10.
    Encoding a sequenceof symbols using LZW CodingEncoding a sequence of symbols using LZW Coding  The encoding process is be illustrated for one line of image having the following intensity values in sequence: 32 32 34 32 34 32 32 33 32 32 32 34.  Consider the table as below:
  • 11.
    Sequence:Sequence: 32 3234 32 34 32 32 33 32 32 32 34.32 32 34 32 34 32 32 33 32 32 32 34.
  • 12.
    Decoding a Lempel-Zivencoded sequenceDecoding a Lempel-Ziv encoded sequence
  • 13.
    Table 27-3 providesthe step-by-step details for an example input file consisting of 45 bytes, the ASCII text string: the/rain/in/Spain/falls/mainly/on/the/plain. When we say that the LZW algorithm reads the character "a" from the input file, we mean it reads the value: 01100001 (97 expressed in 8 bits), where 97 is "a" in ASCII. When we say it writes the character "a" to the encoded file, we mean it writes: 000001100001 (97 expressed in 12 bits).
  • 14.
    Advantages and disadvantagesof LZW codingAdvantages and disadvantages of LZW coding Advantages:  Extremely effective when there are repeated patterns in the data that are widely spread  Prior knowledge of probability of occurrence of symbols to be encoded is not required.  Simple coding technique with high compression ratio.  LZW compression is fast  Lossless compression technique Disadvantages:  Creates entries in the dictionary that may never be used.  LZW is a fairly old compression technique
  • 15.
    Applications of LZWcodingApplications of LZW coding LZW compression can be used in a variety of file formats:  TIFF (tagged image file format )files  GIF (graphic interchange format ) files  PDF(portable document format) files  Unix Compress, gzip.  Suitable for compressing text files