COMS 161 Introduction to Computing Title: Digital Images Date: February 28, 2005 Lecture Number: 19
Announcements Homework Due 3/4/05
Review Storing Images File formats gif jpeg
Outline Jpeg Gif LZW Image compression experiment Image compression scheme LZW
Compressing Images Bitmap images typically do not use compression File size: 270,870 Bytes Image width: 485 height: 186 Bits per pixel: 24 (RGB) 7
Compressing Images Science Use XnView Read in a bmp image Display it Save it as a jpeg image Fidelity adjustment is modified 7
Compressing Images bmp image File size: 271,235 bytes jpeg image with 100% quality File size: 50,235 bytes 7
Compressing Images Gray scale difference image Range of values: 0 – 18 gray scale values 7
Compressing Images bmp image File size: 271,235 bytes jpeg image with 90% quality File size: 21,207 bytes 7
Compressing Images Gray scale difference image Range of values: 0 – 22 gray scale values 7
Compressing Images bmp image File size: 271,235 bytes jpeg image with 70% quality File size: 13,079 bytes 7
Compressing Images Gray scale difference image Range of values: 0 – 45 gray scale values 7
Compressing Images bmp image File size: 271,235 bytes jpeg image with 50% quality File size: 10,335 bytes 7
Compressing Images Gray scale difference image Range of values: 0 – 58 gray scale values 7
Compressing Images bmp image File size: 271,235 bytes jpeg image with 25% quality File size: 7,522 bytes 7
Compressing Images Gray scale difference image Range of values: 0 – 79 gray scale values 7
Compressing Images bmp image File size: 271,235 bytes jpeg image with 10% quality File size: 4,986 bytes 7
Compressing Images Gray scale difference image Range of values: 0 – 118 gray scale values 7
Compressing Images bmp image File size: 271,235 bytes jpeg image with 5% quality File size: 3,765 bytes 7
Compressing Images Gray scale difference image Range of values: 0 – 171 gray scale values 7
Compressing Images bmp image File size: 271,235 bytes jpeg image with 1% quality File size: 3,151 bytes 7
Compressing Images Gray scale difference image Range of values: 0 – 250 gray scale values 7
Compressing Images GIF (Graphic Interchange Format) Codec Invented by CompuServe as a universal format for graphics GIF compression algorithm owned by Unisys Producers of GIF images need a license GIFs are good for buttons, banners, text (in graphic form), and simplistic images 7
Compressing Images Two flavors of GIF images GIF87a GIF89a Supports animation GIF images allow only 256 colors Allow for a transparent color 7
Compressing Images GIF compression algorithm Why are the sized different? Has to do with the compression algorithm File size: 4814 bytes File size: 5652 bytes 7
Compressing Images GIF compression algorithm Horizontal image Row 1: A big long red line Row 2: A big long red line Row 3: A big long red line Row 4: A big long yellow line Vertical image Row 1: a few green pixels, a few carolina blue pixels, a few red pixels … Row 2: a few green pixels, a few carolina blue pixels, a few red pixels … 7
Compressing Images GIF compression algorithm Vertical image requires more information per row Leads to a larger file Good compression for images with nearly uniform background 7
Compressing Images Lempel Ziv Welch compression algorithm Relies on reoccurrence of byte sequences (strings) A table maps input strings to associated output codes The table initially contains mappings for all possible strings of length one Input is taken one byte at a time to find the longest initial string present in the table The code for that string is output and then the string is extended with one more input byte, b. 7
Compressing Images Lempel Ziv Welch compression algorithm A new entry is added to the table mapping the extended string to the next unused code (obtained by incrementing a counter) The process repeats, starting from byte b The number of bits in an output code, and hence the maximum number of entries in the table is usually fixed and once this limit is reached, no more entries are added 7