Compression of GIF images
GIF (Graphics Interchange Format) is not a data compression method. The original version of GIF is known as GIF87a. It is graphical image format that uses variant of LZW to compress the graphical data and allows to send image between different computers. It scans the image row by row and discovers pixel correlated within row not between rows. GIF uses growing and dynamic dictionary for compressing data.
- It takes number of bits per pixel b as parameter. For monochromatic image b=2 and for image with 256 colors or shades b=8.
- It uses dictionary with 2^(b+1) entries. At each fill up dictionary will be in double in size until 4096 entries and remain as static.
- At this point, encoder monitors the compression ratio and may decide to discard dictionary and start with new and empty one.
- At the time of taking decisions on discard, Encoder emits 2^b value as clear code which is sign for decoder to discard the dictionary.
Pointer get longer one byte from dictionary to dictionary and output are in block of 8 bytes. Each pointer preceded by header of 255 bytes maximum and terminates by bytes of 8 zeros. Pointer stores with LSB(Least Significant Bit) on left. Last block contains of value which is 2^(b+1).
GIF compression is inefficient because GIF is in one dimensional while image is in two dimensional. So, GIF is not used by today’s web browsers.