0% found this document useful (0 votes)
32 views3 pages

Steps:: GIF (Graphics Interchange Format) LZW

Uploaded by

nagalaks.ece
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views3 pages

Steps:: GIF (Graphics Interchange Format) LZW

Uploaded by

nagalaks.ece
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

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.
Steps:
1. 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.
2. 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.
3. At this point, encoder monitors the compression ratio and may decide to discard
dictionary and start with new and empty one.
4. 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.
GIFs generally allow up to 8 bits per pixel per image and up to 256 colors. By contrast, the
more advanced JPEG format can display up to 16 million colors, very close to the limit of the
human eye.
GIF File Format: How Does GIF Work
GIF files describe a logical screen with a graphical area of a fixed size. This screen may
contain one, multiple, or no images. A GIF file may contain a single image filling the whole
logical screen, or it may divide the screen into separate smaller images. These images can
function as animation frames in animated GIF files, but they don’t have to fill the whole
logical screen.
A GIF file starts with a header with a fixed length – for example, GIF87a or GIF89a. It
provides the file version and logical screen descriptor (also with a fixed length) specifying
logical screen dimensions in pixels and additional characteristics. The descriptor can specify
if there is a Global Color Table (GCT), followed by the size description if present.
The GIF file then splits into various segments introduced with a single-byte sentinel:
 The image – starts with 0x2C and an ASCII comma
 The extension block – starts with 0x21 and an ASCII exclamation point
 The trailer – has a 1-byte value of 0x3B and an ASCII semicolon (this should be the
file’s last byte)
The image component begins with a fixed-length image descriptor that specifies if a local
color table is present (and its size). Following is the image data, with a single byte providing
the unencoded symbol width (in bits) – there must be minimum 2-bit width. Next is a linked
list with sub-blocks defining the data encoded by LZW.
The extension blocks extend the 87a definition using a pre-defined mechanism from the 87a
spec. Each block consists of a sentinel and another byte specifying the extension type,
followed by a linked list with sub-blocks for the extension data. An extension block that
modifies an image must precede the file segment containing the relevant image. For example,
graphic control extensions can specify optional animation delay times and transparent
background colors, but they must be next to the affected image.
The extension blocks and image data use linked lists consisting of several sub-blocks. Every
sub-block starts with a single byte specifying the number of data bytes following it within the
sub-block (up to 255). Each sub-block series ends with an empty (0-byte) sub-block.
This file structure enables parsing even when a decoder does not understand some parts of the
file. GIFs marked with an 87a can include extension blocks – the idea is for the decoder to
read and display files while ignoring features in the extensions it doesn’t understand.
What Are GIFs Used For?
GIFs have a variety of uses, both personal and professional:
 Marketing—GIFs provide a simple, lightweight mechanism for promoting products
and services. GIF images and animations can be used to share brand images, create
banner ads, and even show a quick animated preview of how products work and their
benefits.
 Information sharing—GIFs can be used to deliver graphs and charts with engaging
animation effects, to help users better understand complex information. Animated
GIFs can be used to create step-by-step how-to guides that are lightweight and can be
viewed on any device.
 Social media engagement—GIFs are used to create animated responses to social
media discussions and add humor to blog posts, allowing brands to improve customer
relationships and create a better connection with digital-first consumers.
GIF Format: Pros and Cons
Benefits of GIFs:
 Small file size—GIFs provide a relatively small file size compared to other image
formats. They can be downloaded faster without sacrificing quality, and are especially
suitable for environments with limited bandwidth and computing resources.
 Transparent background—both regular GIFs and animated GIFs support
transparent backgrounds. This can let you combine GIF images with background
colors, images, or animations, to create innovative web designs.
 Easy to use animation—animated GIFs are easy to create and easy to consume on
almost any device. This can help creators and website owners deliver a better
experience to their audiences.
Shortcomings of GIFs:
 Limited color scheme—both GIFs and animated GIFs support only a 256-color
palette, making it look less attractive and detailed than other image formats. In some
cases, the image may appear slightly jagged or pixelated.
 Cannot be edited—an animated GIF has the frames and animation encoded in the
actual file, and cannot be edited. To modify an animated GIF, you must recreate it
from the
 Heavyweight compared to other animation formats—while animated GIFs have
advantages, they have a heavier file size than other optimized video formats. Adding a
large number of animated GIFs to web pages can make them load slower. It is a best
practice to use HTML5 video instead of animated GIF to improve performance.

You might also like