📄 gif87.htm
字号:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>gif graphics interchange format</title>
<meta name="generator" content="microsoft frontpage 3.0">
</head>
<body background="../jpg/di1.JPG">
<p align="center"><font size="6" color="#0000ff">gif graphics interchange format</font></p>
<div align="center"><center>
<table border="0" width="88%">
<tr>
<td width="100%"><br>
a standard defining a mechanism<br>
for the storage and transmission<br>
of raster-based graphics information<br>
june 15, 1987<br>
(c) compuserve incorporated, 1987<br>
all rights reserved<br>
while this document is copyrighted, the information<br>
contained within is made available for use in computer<br>
software without royalties, or licensing restrictions.<br>
gif and 'graphics interchange format' are trademarks of<br>
compuserve, incorporated.<br>
an h&r block company<br>
5000 arlington centre blvd.<br>
columbus, ohio 43220<br>
(614) 457-8600<br>
page 2<br>
graphics interchange format (gif) specification<br>
table of contents<br>
introduction . . . . . . . . . . . . . . . . . page 3<br>
general file format . . . . . . . . . . . . . page 3<br>
gif signature . . . . . . . . . . . . . . . . page 4<br>
screen descriptor . . . . . . . . . . . . . . page 4<br>
global color map . . . . . . . . . . . . . . . page 5<br>
image descriptor . . . . . . . . . . . . . . . page 6<br>
local color map . . . . . . . . . . . . . . . page 7<br>
raster data . . . . . . . . . . . . . . . . . page 7<br>
gif terminator . . . . . . . . . . . . . . . . page 8<br>
gif extension blocks . . . . . . . . . . . . . page 8<br>
appendix a - glossary . . . . . . . . . . . . page 9<br>
appendix b - interactive sequences . . . . . . page 10<br>
appendix c - image packaging & compression . . page 12<br>
appendix d - multiple image processing . . . . page 15<br>
graphics interchange format (gif) page 3<br>
specification<br>
introduction<br>
'gif' (tm) is compuserve's standard for defining generalized color<br>
raster images. this 'graphics interchange format' (tm) allows<br>
high-quality, high-resolution graphics to be displayed on a variety of<br>
graphics hardware and is intended as an exchange and display mechanism<br>
for graphics images. the image format described in this document is<br>
designed to support current and future image technology and will in<br>
addition serve as a basis for future compuserve graphics products.<br>
the main focus of this document is to provide the technical<br>
information necessary for a programmer to implement gif encoders and<br>
decoders. as such, some assumptions are made as to terminology relavent<br>
to graphics and programming in general.<br>
the first section of this document describes the gif data format<br>
and its components and applies to all gif decoders, either as standalone<br>
programs or as part of a communications package. appendix b is a<br>
section relavent to decoders that are part of a communications software<br>
package and describes the protocol requirements for entering and exiting<br>
gif mode, and responding to host interrogations. a glossary in appendix<br>
a defines some of the terminology used in this document. appendix c<br>
gives a detailed explanation of how the graphics image itself is<br>
packaged as a series of data bytes.<br>
graphics interchange format data definition<br>
general file format<br>
+-----------------------+<br>
| +-------------------+ |<br>
| | gif signature | |<br>
| +-------------------+ |<br>
| +-------------------+ |<br>
| | screen descriptor | |<br>
| +-------------------+ |<br>
| +-------------------+ |<br>
| | global color map | |<br>
| +-------------------+ |<br>
. . . . . .<br>
| +-------------------+ | ---+ <br>
| | image descriptor | | | <br>
| +-------------------+ | | <br>
| +-------------------+ | | <br>
| | local color map | | |- repeated 1 to n times<br>
| +-------------------+ | | <br>
| +-------------------+ | | <br>
| | raster data | | | <br>
| +-------------------+ | ---+ <br>
. . . . . . <br>
|- gif terminator -| <br>
+-----------------------+<br>
graphics interchange format (gif) page 4<br>
specification<br>
gif signature<br>
the following gif signature identifies the data following as a<br>
valid gif image stream. it consists of the following six characters:<br>
g i f 8 7 a<br>
the last three characters '87a' may be viewed as a version number<br>
for this particular gif definition and will be used in general as a<br>
reference in documents regarding gif that address any version<br>
dependencies.<br>
screen descriptor<br>
the screen descriptor describes the overall parameters for all gif<br>
images following. it defines the overall dimensions of the image space<br>
or logical screen required, the existance of color mapping information,<br>
background../jpg/di1.JPGn color, and color depth information. this information<br>
is stored in a series of 8-bit bytes as described below.<br>
bits<br>
7 6 5 4 3 2 1 0 byte #<br>
+---------------+<br>
| | 1<br>
+-screen width -+ raster width in pixels (lsb first)<br>
| | 2<br>
+---------------+<br>
| | 3<br>
+-screen height-+ raster height in pixels (lsb first)<br>
| | 4<br>
+-+-----+-+-----+ m = 1, global color map follows descriptor<br>
|m| cr |0|pixel| 5 cr+1 = # bits of color resolution<br>
+-+-----+-+-----+ pixel+1 = # bits/pixel in image<br>
| background | 6 background=../jpg/di1.JPG index of screen background<br>
+---------------+ (color is defined from the global color<br>
|0 0 0 0 0 0 0 0| 7 map or default map if none specified)<br>
+---------------+<br>
the logical screen width and height can both be larger than the<br>
physical display. how images larger than the physical display are<br>
handled is implementation dependent and can take advantage of hardware<br>
characteristics (e.g. macintosh scrolling windows). otherwise images<br>
can be clipped to the edges of the display.<br>
the value of 'pixel' also defines the maximum number of colors<br>
within an image. the range of values for 'pixel' is 0 to 7 which<br>
represents 1 to 8 bits. this translates to a range of 2 (b & w) to 256<br>
colors. bit 3 of word 5 is reserved for future definition and must be<br>
zero.<br>
graphics interchange format (gif) page 5<br>
specification<br>
global color map<br>
the global color map is optional but recommended for images where<br>
accurate color rendition is desired. the existence of this color map is<br>
indicated in the 'm' field of byte 5 of the screen descriptor. a color<br>
map can also be associated with each image in a gif file as described<br>
later. however this global map will normally be used because of<br>
hardware restrictions in equipment available today. in the individual<br>
image descriptors the 'm' flag will normally be zero. if the global<br>
color map is present, it's definition immediately follows the screen<br>
descriptor. the number of color map entries following a screen<br>
descriptor is equal to 2**(# bits per pixel), where each entry consists<br>
of three byte values representing the relative intensities of red, green<br>
and blue respectively. the structure of the color map block is:<br>
bits<br>
7 6 5 4 3 2 1 0 byte #<br>
+---------------+<br>
| red intensity | 1 red value for color index 0<br>
+---------------+<br>
|green intensity| 2 green value for color index 0<br>
+---------------+<br>
| blue intensity| 3 blue value for color index 0<br>
+---------------+<br>
| red intensity | 4 red value for color index 1<br>
+---------------+<br>
|green intensity| 5 green value for color index 1<br>
+---------------+<br>
| blue intensity| 6 blue value for color index 1<br>
+---------------+<br>
: : (continues for remaining colors)<br>
each image pixel value received will be displayed according to its<br>
closest match with an available color of the display based on this color<br>
map. the color components represent a fractional intensity value from<br>
none (0) to full (255). white would be represented as (255,255,255),<br>
black as (0,0,0) and medium yellow as (180,180,0). for display, if the<br>
device supports fewer than 8 bits per color component, the higher order<br>
bits of each component are used. in the creation of a gif color map<br>
entry with hardware supporting fewer than 8 bits per component, the<br>
component values for the hardware should be converted to the 8-bit<br>
format with the following calculation:<br>
<map_value> = <component_value>*255/(2**<nbits> -1)<br>
this assures accurate translation of colors for all displays. in<br>
the cases of creating gif images from hardware without color palette<br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -