ImageGear for C and C++ on Windows v20.1 - Updated
GIF Metadata Structure
User Guide > File Formats and Compressions > File Formats > Metadata Structures > GIF Metadata Structure

The GIF file format is complex and has different non-image data that can be stored before and after an image data. The GIF metadata design allows you to read/write any GIF non-image data and prevents misunderstanding with GIF extensions storing order.

The following metadata are always saved before an image data:

The metadata of GIF extensions that are inside GIF Extensions After Image Level (between items with Name "AfterImageExtensions" and Id 0xFFF (Type LEVEL_START and LEVEL_END)) are saved after an image data.

All other GIF Extensions Metadata are saved before an image data.

You can work with GIF metadata only when the ImageGear LZW Component is attached to the core ImageGear module. See Attaching Components.

GIF Metadata Level

Name Id Type Value Type Value Value Length Read Only
"GIF" IG_FORMAT_GIF LEVEL_START 0 NULL 0 TRUE
GIF header level
GIF Logical Screen Descriptor level
GIF Image Descriptor level
optional Global and/or Local Color Tables and optional GIF Extensions levels (extensions before image)
"GIF" IG_FORMAT_GIF LEVEL_END 0 NULL 0 TRUE

All items between items with Name "GIF" and Id IG_FORMAT_GIF (Type LEVEL_START and LEVEL_END) are interpreted as GIF data. If during sending data from application level to filter level the first item is omitted the data will not be interpreted and saved.

GIF Header Level

Name Id Type Value Type Value Value Length Read Only
"GIFHeader" 0x10 LEVEL_START 0 NULL 0 TRUE
"Signature" 0x101 VALUE_ITEM STRING "GIF" 3 TRUE
"Version" 0x102 VALUE_ITEM STRING   3 TRUE
"GIFHeader" 0x10 LEVEL_END 0 NULL 0 TRUE

GIF Logical Screen Descriptor Level

Name Id Type Value Type Value Value Length Read Only
"LogicalScreenDescriptor" 0x20 LEVEL_START 0 NULL 0 TRUE
"LogicalScreenWidth" 0x201 VALUE_ITEM UINT16   1 FALSE
"LogicalScreenHeight" 0x202 VALUE_ITEM UINT16   1 FALSE
 
"Fields" 0x205 LEVEL_START 0 NULL 0 TRUE
"GlobalColorTableFlag" 0x206 VALUE_ITEM BOOL   1 FALSE
"ColorResolution" 0x207 VALUE_ITEM UINT8   1 FALSE
"SortFlag" 0x208 VALUE_ITEM BOOL   1 FALSE
"GlobalColorTableSize" 0x209 VALUE_ITEM UINT8   1 FALSE
"Fields" 0x205 LEVEL_END 0 NULL 0 TRUE
 
"BackgroundColorIndex" 0x203 VALUE_ITEM UINT8     FALSE
"PixelAspectRatio" 0x204 VALUE_ITEM UINT8     FALSE
"LogicalScreenDescriptor" 0x20 LEVEL_END 0 NULL 0 TRUE

GIF Global Color Table Level

Name Id Type Value Type Value Value Length Read Only
"GlobalColorTable" 0x30 VALUE_ITEM RAW_DATA Variable TRUE

GIF Image Descriptor Level

Name Id Type Value Type Value Value Length Read Only
"ImageDescriptor" 0x2C LEVEL_START 0 NULL 0 TRUE
"ImageLeftPosi tion" 0x2C1 VALUE_ITEM UINT16   1 FALSE
"ImageTopPosition" 0x2C2 VALUE_ITEM UINT16   1 FALSE
"ImageWidth" 0x2C3 VALUE_ITEM     1 FALSE
"ImageHeight" 0x2C4 VALUE_ITEM     1 FALSE
 
"Fields" 0x2C5 LEVEL_START 0 NULL 0 TRUE
"LocalColorTableFlag" 0x2C6 VALUE_ITEM BOOL   1 FALSE
"InterlaceFlag" 0x2C7 VALUE_ITEM BOOL   1 FALSE
"SortFlag" 0x2C8 VALUE_ITEM BOOL   1 FALSE
"LocalColorTableSize" 0x2C9 VALUE_ITEM UINT8   1 FALSE
"Fields" 0x2C5 LEVEL_END 0 NULL 0 TRUE
 
"ImageDescriptor" 0x2C LEVEL_END 0 NULL 0 TRUE

GIF Local Color Table Level

Name Id Type Value Type Value Value Length Read Only
"LocalColorTable" 0x40 VALUE_ITEM RAW_DATA Variable TRUE

GIF Extensions Metadata

GIF Graphic Control Extension Level

Name Id Type Value Type Value Value Length Read Only
"GraphicControlExtension" 0xF9 LEVEL_START 0 NULL 0 TRUE
 
"Fields" 0xF91 LEVEL_START 0 NULL 0 TRUE
"DisposalMethod" 0xF92 VALUE_ITEM UINT8   1 FALSE
"UserInputFlag" 0xF93 VALUE_ITEM BOOL   1 FALSE
"TransparentColorFlag" 0xF94 VALUE_ITEM BOOL   1 FALSE
"Fields" 0xF91 LEVEL_END 0 NULL 0 TRUE
 
"DelayTime" 0xF95 VALUE_ITEM UINT16   1 FALSE
"TransparentColorIndex" 0xF96 VALUE_ITEM UINT8   1 FALSE
"GraphicControlExtension" 0xF9 LEVEL_END 0 NULL 0 TRUE

GIF Comment Extension Level

Name Id Type Value Type Value Value Length Read Only
"CommentExtension" 0xFE VALUE_ITEM STRING Variable TRUE

GIF Application Extension Level

Name Id Type Value Type Value Value Length Read Only
"ApplicationExtension" 0xFF LEVEL_START 0 NULL 0 TRUE
"ApplicationIdentifier" 0xFF1 VALUE_ITEM STRING   8 FALSE
"Appl.AuthenticationCode" 0xFF2 VALUE_ITEM UINT8   4 FALSE
"ApplicationData" 0xFF3 VALUE_ITEM RAW_DATA   Variable FALSE
"ApplicationExtension" 0xFF LEVEL_END 0 NULL 0 TRUE

GIF Plain Text Extension Level

Name Id Type Value Type Value Value Length Read Only
"PlainTextExtension" 0x01 LEVEL_START 0 NULL 0 TRUE
"TextGridLeftPosition" 0x11 VALUE_ITEM UINT16   1 FALSE
"TextGridTopPosition" 0x12 VALUE_ITEM UINT16   1 FALSE
"TextGridWidth" 0x13 VALUE_ITEM UINT16   1 FALSE
"TextGridHeight" 0x14 VALUE_ITEM UINT16   1 FALSE
"CharacterCellWidth" 0x15 VALUE_ITEM UINT8   1 FALSE
"CharacterCellHeight" 0x16 VALUE_ITEM UINT8   1 FALSE
"TextForegroundColorIndex" 0x17 VALUE_ITEM UINT8   1 FALSE
"TextBackgroundColorIndex" 0x18 VALUE_ITEM UINT8   1 FALSE
"PlainTextData" 0x19 VALUE_ITEM STRING   Variable FALSE

GIF Extensions After Image Level

Name Id Type Value Type Value Value Length Read Only
"AfterImageExtensions" 0xFFF LEVEL_START 0 NULL 0 TRUE
One or more GIF extension levels
"AfterImageExtensions" 0xFFF LEVEL_END 0 NULL 0 TRUE

Callback Required for Writing GIF Metadata Items

The GIF Logical Screen Descriptor Level and GIF Image Descriptor Level metadata items can be written using LPAFT_IG_METAD_ITEM_SET_CB callback function.

Other GIF metadata can be written using LPAFT_IG_METAD_ITEM_ADD_CB callback function.

GIF Metadata Item ID Constants

Please see file enumIGGIFTagIDs for the complete list of GIF Metadata Item Id constants.

Is this page helpful?
Yes No
Thanks for your feedback.