0N/A<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
0N/ACopyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. 0N/ADO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/AThis code is free software; you can redistribute it and/or modify it 0N/Aunder the terms of the GNU General Public License version 2 only, as 0N/Apublished by the Free Software Foundation. Oracle designates this 0N/Aparticular file as subject to the "Classpath" exception as provided 0N/Aby Oracle in the LICENSE file that accompanied this code. 0N/AThis code is distributed in the hope that it will be useful, but WITHOUT 0N/AANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/AFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/Aversion 2 for more details (a copy is included in the LICENSE file that 0N/Aaccompanied this code). 2362N/AYou should have received a copy of the GNU General Public License version 2362N/A2 along with this work; if not, write to the Free Software Foundation, 0N/AInc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/APlease contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/ACA 95054 USA or visit www.sun.com if you need additional information or 0N/A<
title>GIF Metadata Format Specification</
title>
0N/A<
body bgcolor="white">
GIF Metadata Format Specification
<
a name="gif_stream_metadata_format">
GIF Stream Metadata Format Specification
The GIF stream metadata format encodes the information stored in the
per-file header, namely the file version, logical screen descriptor,
and the global color table.
The logical screen descriptor describes the overall width and height
of an animated file, as well as information about the color resolution
(number of bits per pixel) and pixel aspect ratio.
The global color table contains a color lookup table that is used for
images that do not have their own local color table.
<!DOCTYPE "javax_imageio_gif_stream_1.0" [
<!ELEMENT "javax_imageio_gif_stream_1.0" (Version?,
LogicalScreenDescriptor?, GlobalColorTable?)>
<!ELEMENT "Version" EMPTY>
<!-- The file version, either 87a or 89a -->
<!ATTLIST "Version" "value" ("87a" | "89a") #REQUIRED>
<!-- The version string -->
<!ELEMENT "LogicalScreenDescriptor" EMPTY>
<!-- The logical screen descriptor, except for the global color table -->
<!ATTLIST "LogicalScreenDescriptor" "logicalScreenWidth" #CDATA
<!-- The width in pixels of the whole picture -->
<!-- Data type: Integer -->
<!-- Min value: 1 (inclusive) -->
<!-- Max value: 65535 (inclusive) -->
<!ATTLIST "LogicalScreenDescriptor" "logicalScreenHeight" #CDATA
<!-- The height in pixels of the whole picture -->
<!-- Data type: Integer -->
<!-- Min value: 1 (inclusive) -->
<!-- Max value: 65535 (inclusive) -->
<!ATTLIST "LogicalScreenDescriptor" "colorResolution" #CDATA
<!-- The number of bits of color resolution, beteen 1 and 8 -->
<!-- Data type: Integer -->
<!-- Min value: 1 (inclusive) -->
<!-- Max value: 8 (inclusive) -->
<!ATTLIST "LogicalScreenDescriptor" "pixelAspectRatio" #CDATA
<!-- If 0, indicates square pixels, else W/H = (value + 16)/64 -->
<!-- Data type: Integer -->
<!-- Min value: 0 (inclusive) -->
<!-- Max value: 255 (inclusive) -->
<!ELEMENT "GlobalColorTable" (ColorTableEntry)*>
<!-- The global color table -->
<!-- Min children: 2 -->
<!-- Max children: 256 -->
<!ATTLIST "GlobalColorTable" "sizeOfGlobalColorTable" ("2" |
"4" | "8" | "16" | "32" | "64" | "128" | "256") #REQUIRED>
<!-- The number of entries in the global color table -->
<!ATTLIST "GlobalColorTable" "backgroundColorIndex" #CDATA
<!-- The index of the color table entry to be used as a background -->
<!-- Data type: Integer -->
<!-- Min value: 0 (inclusive) -->
<!-- Max value: 255 (inclusive) -->
<!ATTLIST "GlobalColorTable" "sortFlag" ("TRUE" | "FALSE")
<!-- True if the global color table is sorted by frequency -->
<!ELEMENT "ColorTableEntry" EMPTY>
<!-- A global color table entry -->
<!ATTLIST "ColorTableEntry" "index" #CDATA #REQUIRED>
<!-- The index of the color table entry -->
<!-- Data type: Integer -->
<!-- Min value: 0 (inclusive) -->
<!-- Max value: 255 (inclusive) -->
<!ATTLIST "ColorTableEntry" "red" #CDATA #REQUIRED>
<!-- The red value for the color table entry -->
<!-- Data type: Integer -->
<!-- Min value: 0 (inclusive) -->
<!-- Max value: 255 (inclusive) -->
<!ATTLIST "ColorTableEntry" "green" #CDATA #REQUIRED>
<!-- The green value for the color table entry -->
<!-- Data type: Integer -->
<!-- Min value: 0 (inclusive) -->
<!-- Max value: 255 (inclusive) -->
<!ATTLIST "ColorTableEntry" "blue" #CDATA #REQUIRED>
<!-- The blue value for the color table entry -->
<!-- Data type: Integer -->
<!-- Min value: 0 (inclusive) -->
<!-- Max value: 255 (inclusive) -->
<
a name="gif_image_metadata_format">
GIF Image Metadata Format Specification
The GIF image metadata format encodes the image descriptor, local
color table, and extension information assciated with a single image
within a GIF file, typically a frame of an animation.
The image description contains the offset of the frame within the
logical screen described in the stream metadata, as well as the width
and height of the frame and whether it is used interlaced encoding.
The local color table, if present, supersedes the global color table
The graphic control extension contains information on how the frame is
to be incorporated into the animation. The disposal method indicates
whether the current frame should remain in place
(<
code>doNotDispose</
code>), be restored to the backgound color as
specified in the stream metadata
(<
code>restoreToBackgroundColor</
code>), or be restored to the
previous frame contents (<
code>restoreToPrevious</
code>) prior to
displaying the subsequent frame.
The user input flag indicates whether the animation should pause for
user input before advancing to the next frame. The transparent color
flag and index indicate a color index for which pixels of the frame
should not be drawn. The delay time indicates how long the frame
should be displayed, in hundredths of a second. If the user input
flag is set and the delay time is 0, the frame is intended to be
advanced only on user input.
<!DOCTYPE "javax_imageio_gif_image_1.0" [
<!ELEMENT "javax_imageio_gif_image_1.0" (ImageDescriptor?,
LocalColorTable?, GraphicControlExtension?, PlainTextExtension?,
ApplicationExtensions?, CommentExtensions?)>
<!ELEMENT "ImageDescriptor" EMPTY>
<!-- The image descriptor -->
<!ATTLIST "ImageDescriptor" "imageLeftPosition" #CDATA #REQUIRED>
<!-- The X offset of the image relative to the screen origin -->
<!-- Data type: Integer -->
<!-- Min value: 0 (inclusive) -->
<!-- Max value: 65535 (inclusive) -->
<!ATTLIST "ImageDescriptor" "imageTopPosition" #CDATA #REQUIRED>
<!-- The Y offset of the image relative to the screen origin -->
<!-- Data type: Integer -->
<!-- Min value: 0 (inclusive) -->
<!-- Max value: 65535 (inclusive) -->
<!ATTLIST "ImageDescriptor" "imageWidth" #CDATA #REQUIRED>
<!-- The width of the image -->
<!-- Data type: Integer -->
<!-- Min value: 1 (inclusive) -->
<!-- Max value: 65535 (inclusive) -->
<!ATTLIST "ImageDescriptor" "imageHeight" #CDATA #REQUIRED>
<!-- The height of the image -->
<!-- Data type: Integer -->
<!-- Min value: 1 (inclusive) -->
<!-- Max value: 65535 (inclusive) -->
<!ATTLIST "ImageDescriptor" "interlaceFlag" ("TRUE" | "FALSE")
<!-- True if the image is stored using interlacing -->
<!ELEMENT "LocalColorTable" (ColorTableEntry)*>
<!-- The local color table -->
<!-- Min children: 2 -->
<!-- Max children: 256 -->
<!ATTLIST "LocalColorTable" "sizeOfLocalColorTable" ("2" |
"4" | "8" | "16" | "32" | "64" | "128" | "256") #REQUIRED>
<!-- The number of entries in the local color table -->
<!ATTLIST "LocalColorTable" "sortFlag" ("TRUE" | "FALSE")
<!-- True if the local color table is sorted by frequency -->
<!ELEMENT "ColorTableEntry" EMPTY>
<!-- A local color table entry -->
<!ATTLIST "ColorTableEntry" "index" #CDATA #REQUIRED>
<!-- The index of the color table entry -->
<!-- Data type: Integer -->
<!-- Min value: 0 (inclusive) -->
<!-- Max value: 255 (inclusive) -->
<!ATTLIST "ColorTableEntry" "red" #CDATA #REQUIRED>
<!-- The red value for the color table entry -->
<!-- Data type: Integer -->
<!-- Min value: 0 (inclusive) -->
<!-- Max value: 255 (inclusive) -->
<!ATTLIST "ColorTableEntry" "green" #CDATA #REQUIRED>
<!-- The green value for the color table entry -->
<!-- Data type: Integer -->
<!-- Min value: 0 (inclusive) -->
<!-- Max value: 255 (inclusive) -->
<!ATTLIST "ColorTableEntry" "blue" #CDATA #REQUIRED>
<!-- The blue value for the color table entry -->
<!-- Data type: Integer -->
<!-- Min value: 0 (inclusive) -->
<!-- Max value: 255 (inclusive) -->
<!ELEMENT "GraphicControlExtension" EMPTY>
<!-- A graphic control extension -->
<!ATTLIST "GraphicControlExtension" "disposalMethod" ("none" |
"doNotDispose" | "restoreToBackgroundColor" |
"restoreToPrevious" | "undefinedDisposalMethod4" |
"undefinedDisposalMethod5" | "undefinedDisposalMethod6" |
"undefinedDisposalMethod7") #REQUIRED>
<!-- The disposal method for this frame -->
<!ATTLIST "GraphicControlExtension" "userInputFlag" ("TRUE" |
<!-- True if the frame should be advanced based on user input -->
<!ATTLIST "GraphicControlExtension" "transparentColorFlag" (
"TRUE" | "FALSE") #REQUIRED>
<!-- True if a transparent color exists -->
<!ATTLIST "GraphicControlExtension" "delayTime" #CDATA #REQUIRED>
<!-- The time to delay between frames, in hundredths of a second -->
<!-- Data type: Integer -->
<!-- Min value: 0 (inclusive) -->
<!-- Max value: 65535 (inclusive) -->
<!ATTLIST "GraphicControlExtension" "transparentColorIndex"
<!-- The transparent color, if transparentColorFlag is true -->
<!-- Data type: Integer -->
<!-- Min value: 0 (inclusive) -->
<!-- Max value: 255 (inclusive) -->
<!ELEMENT "PlainTextExtension" EMPTY>
<!-- A plain text (text grid) extension -->
<!ATTLIST "PlainTextExtension" "textGridLeft" #CDATA #REQUIRED>
<!-- The X offset of the text grid -->
<!-- Data type: Integer -->
<!-- Min value: 0 (inclusive) -->
<!-- Max value: 65535 (inclusive) -->
<!ATTLIST "PlainTextExtension" "textGridTop" #CDATA #REQUIRED>
<!-- The Y offset of the text grid -->
<!-- Data type: Integer -->
<!-- Min value: 0 (inclusive) -->
<!-- Max value: 65535 (inclusive) -->
<!ATTLIST "PlainTextExtension" "textGridWidth" #CDATA #REQUIRED>
<!-- The number of columns in the text grid -->
<!-- Data type: Integer -->
<!-- Min value: 1 (inclusive) -->
<!-- Max value: 65535 (inclusive) -->
<!ATTLIST "PlainTextExtension" "textGridHeight" #CDATA #REQUIRED>
<!-- The number of rows in the text grid -->
<!-- Data type: Integer -->
<!-- Min value: 1 (inclusive) -->
<!-- Max value: 65535 (inclusive) -->
<!ATTLIST "PlainTextExtension" "characterCellWidth" #CDATA
<!-- The width of a character cell -->
<!-- Data type: Integer -->
<!-- Min value: 1 (inclusive) -->
<!-- Max value: 65535 (inclusive) -->
<!ATTLIST "PlainTextExtension" "characterCellHeight" #CDATA
<!-- The height of a character cell -->
<!-- Data type: Integer -->
<!-- Min value: 1 (inclusive) -->
<!-- Max value: 65535 (inclusive) -->
<!ATTLIST "PlainTextExtension" "textForegroundColor" #CDATA
<!-- The text foreground color index -->
<!-- Data type: Integer -->
<!-- Min value: 0 (inclusive) -->
<!-- Max value: 255 (inclusive) -->
<!ATTLIST "PlainTextExtension" "textBackgroundColor" #CDATA
<!-- The text background color index -->
<!-- Data type: Integer -->
<!-- Min value: 0 (inclusive) -->
<!-- Max value: 255 (inclusive) -->
<!ELEMENT "ApplicationExtensions" (ApplicationExtension)*>
<!-- A set of application extensions -->
<!-- Min children: 1 -->
<!-- Max children: 2147483647 -->
<!ELEMENT "ApplicationExtension" EMPTY>
<!-- An application extension -->
<!-- User object: array of byte -->
<!-- Min length: 0 -->
<!-- Max length: 2147483647 -->
<!ATTLIST "ApplicationExtension" "applicationID" #CDATA
<!-- The application ID -->
<!-- Data type: String -->
<!ATTLIST "ApplicationExtension" "authenticationCode" #CDATA
<!-- The authentication code -->
<!-- Data type: String -->
<!ELEMENT "CommentExtensions" (CommentExtension)*>
<!-- A set of comments -->
<!-- Min children: 1 -->
<!-- Max children: 2147483647 -->
<!ELEMENT "CommentExtension" EMPTY>
<!ATTLIST "CommentExtension" "value" #CDATA #REQUIRED>
<!-- The comment -->
<!-- Data type: String -->
<
caption><
b>Mapping of Standard to GIF Native Stream Metadata</
b></
caption>
<
th>Standard Metadata Component</
th>
<
th>GIF Native Stream Metadata Component</
th>
<
td>/GlobalColorTable@backgroundColorIndex</
td>
<
td>/LogicalScreenDescriptor@colorResolution</
td>
<
td>/LogicalScreenDescriptor@pixelAspectRatio</
td>
<
td>/LogicalScreenDescriptor@logicalScreenWidth</
td>
<
td>/LogicalScreenDescriptor@logicalScreenHeight</
td>
<
caption><
b>Mapping of Standard to GIF Native Image Metadata</
b></
caption>
<
th>Standard Metadata Component</
th>
<
th>GIF Native Image Metadata Component</
th>
<
td>/ImageDescriptor@imageLeftPosition</
td>
<
td>/ImageDescriptor@imageTopPosition</
td>
<
td>/GraphicControlExtension@transparentColorIndex
(/GraphicControlExtension@transparentColorFlag is also set to