LZW coding
By
Md. Fazle Rabbi
16CSE057
4.2
CONTENTS
• An overview of Image compression
• An Introduction to LZW coding technique
• Methodology (Algorithm) LZW coding
• Advantages and Disadvantages of LZW coding
• Applications of LZW coding
4.3
An overview of Image compression
• Goals of compression
a) Remove redundancy
b) Reduce storage required and hence the cost
c) Reduced bandwidth can be used
• Compression modes
1) Lossless compression
Preserve all information, perfectly recoverable.
2) Lossy compression
Throw away perceptually insignificant information
and cannot recover all bits
4.4
Introduction To LZW
• Lossless Compression
• Compression scheme for Gif, TIFF and PDF
• For 8-bit grayscale images, the first 256 words are
assigned to grayscales 0, 1, …255
• As the encoder scans the image, the grayscale
sequences not in the dictionary are placed in the next
available location.
• The encoded output consists of dictionary entries.
4.5
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.
4.6
Encoding 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:
4.7
Encoding a sequence of symbols using LZW Coding
Sequence: 32 32 34 32 34 32 32 33 32 32 32 34.
4.8
Advantages 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
4.9
Applications 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
4.10
Thank You

11. lzw coding

  • 1.
  • 2.
    4.2 CONTENTS • An overviewof Image compression • An Introduction to LZW coding technique • Methodology (Algorithm) LZW coding • Advantages and Disadvantages of LZW coding • Applications of LZW coding
  • 3.
    4.3 An overview ofImage compression • Goals of compression a) Remove redundancy b) Reduce storage required and hence the cost c) Reduced bandwidth can be used • Compression modes 1) Lossless compression Preserve all information, perfectly recoverable. 2) Lossy compression Throw away perceptually insignificant information and cannot recover all bits
  • 4.
    4.4 Introduction To LZW •Lossless Compression • Compression scheme for Gif, TIFF and PDF • For 8-bit grayscale images, the first 256 words are assigned to grayscales 0, 1, …255 • As the encoder scans the image, the grayscale sequences not in the dictionary are placed in the next available location. • The encoded output consists of dictionary entries.
  • 5.
    4.5 Example • Consider animage 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.
  • 6.
    4.6 Encoding a sequenceof 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:
  • 7.
    4.7 Encoding a sequenceof symbols using LZW Coding Sequence: 32 32 34 32 34 32 32 33 32 32 32 34.
  • 8.
    4.8 Advantages and disadvantagesof 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
  • 9.
    4.9 Applications of LZWcoding 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
  • 10.