⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gif87.htm

📁 刚刚看到本站有Visual C++数字图象处理(人民邮电出版社)的电子书
💻 HTM
📖 第 1 页 / 共 3 页
字号:
    capability, a fixed palette should be created based on the available<br>

    display colors for that hardware. if no global color map is indicated,<br>

    a default color map is generated internally which maps each possible<br>

    incoming color index to the same hardware color index modulo &lt;n&gt; where<br>

    &lt;n&gt; is the number of available hardware colors.<br>

    graphics interchange format (gif) page 6<br>

    specification<br>

    image descriptor<br>

    the image descriptor defines the actual placement and extents of<br>

    the following image within the space defined in the screen descriptor.<br>

    also defined are flags to indicate the presence of a local color lookup<br>

    map, and to define the pixel display sequence. each image descriptor is<br>

    introduced by an image separator character. the role of the image<br>

    separator is simply to provide a synchronization character to introduce<br>

    an image descriptor. this is desirable if a gif file happens to contain<br>

    more than one image. this character is defined as 0x2c hex or ','<br>

    (comma). when this character is encountered between images, the image<br>

    descriptor will follow immediately.<br>

    any characters encountered between the end of a previous image and<br>

    the image separator character are to be ignored. this allows future gif<br>

    enhancements to be present in newer image formats and yet ignored safely<br>

    by older software decoders.<br>

    bits<br>

    7 6 5 4 3 2 1 0 byte #<br>

    +---------------+<br>

    |0 0 1 0 1 1 0 0| 1 ',' - image separator character<br>

    +---------------+<br>

    | | 2 start of image in pixels from the<br>

    +- image left -+ left side of the screen (lsb first)<br>

    | | 3<br>

    +---------------+<br>

    | | 4<br>

    +- image top -+ start of image in pixels from the<br>

    | | 5 top of the screen (lsb first)<br>

    +---------------+<br>

    | | 6<br>

    +- image width -+ width of the image in pixels (lsb first)<br>

    | | 7<br>

    +---------------+<br>

    | | 8<br>

    +- image height-+ height of the image in pixels (lsb first)<br>

    | | 9<br>

    +-+-+-+-+-+-----+ m=0 - use global color map, ignore 'pixel'<br>

    |m|i|0|0|0|pixel| 10 m=1 - local color map follows, use 'pixel'<br>

    +-+-+-+-+-+-----+ i=0 - image formatted in sequential order<br>

    i=1 - image formatted in interlaced order<br>

    pixel+1 - # bits per pixel for this image<br>

    the specifications for the image position and size must be confined<br>

    to the dimensions defined by the screen descriptor. on the other hand<br>

    it is not necessary that the image fill the entire screen defined.<br>

    local color map<br>

    graphics interchange format (gif) page 7<br>

    specification<br>

    a local color map is optional and defined here for future use. if<br>

    the 'm' bit of byte 10 of the image descriptor is set, then a color map<br>

    follows the image descriptor that applies only to the following image.<br>

    at the end of the image, the color map will revert to that defined after<br>

    the screen descriptor. note that the 'pixel' field of byte 10 of the<br>

    image descriptor is used only if a local color map is indicated. this<br>

    defines the parameters not only for the image pixel size, but determines<br>

    the number of color map entries that follow. the bits per pixel value<br>

    will also revert to the value specified in the screen descriptor when<br>

    processing of the image is complete.<br>

    raster data<br>

    the format of the actual image is defined as the series of pixel<br>

    color index values that make up the image. the pixels are stored left<br>

    to right sequentially for an image row. by default each image row is<br>

    written sequentially, top to bottom. in the case that the interlace or<br>

    'i' bit is set in byte 10 of the image descriptor then the row order of<br>

    the image display follows a four-pass process in which the image is<br>

    filled in by widely spaced rows. the first pass writes every 8th row,<br>

    starting with the top row of the image window. the second pass writes<br>

    every 8th row starting at the fifth row from the top. the third pass<br>

    writes every 4th row starting at the third row from the top. the fourth<br>

    pass completes the image, writing every other row, starting at the<br>

    second row from the top. a graphic description of this process follows:<br>

    image<br>

    row pass 1 pass 2 pass 3 pass 4 result<br>

    ---------------------------------------------------<br>

    0 **1a** **1a**<br>

    1 **4a** **4a**<br>

    2 **3a** **3a**<br>

    3 **4b** **4b**<br>

    4 **2a** **2a**<br>

    5 **4c** **4c**<br>

    6 **3b** **3b**<br>

    7 **4d** **4d**<br>

    8 **1b** **1b**<br>

    9 **4e** **4e**<br>

    10 **3c** **3c**<br>

    11 **4f** **4f**<br>

    12 **2b** **2b**<br>

    . . . <br>

    the image pixel values are processed as a series of color indices<br>

    which map into the existing color map. the resulting color value from<br>

    the map is what is actually displayed. this series of pixel indices,<br>

    the number of which is equal to image-width*image-height pixels, are<br>

    passed to the gif image data stream one value per pixel, compressed and<br>

    packaged according to a version of the lzw compression algorithm as<br>

    defined in appendix c.<br>

    graphics interchange format (gif) page 8<br>

    specification<br>

    gif terminator<br>

    in order to provide a synchronization for the termination of a gif<br>

    image file, a gif decoder will process the end of gif mode when the<br>

    character 0x3b hex or ';' is found after an image has been processed.<br>

    by convention the decoding software will pause and wait for an action<br>

    indicating that the user is ready to continue. this may be a carriage<br>

    return entered at the keyboard or a mouse click. for interactive<br>

    applications this user action must be passed on to the host as a<br>

    carriage return character so that the host application can continue.<br>

    the decoding software will then typically leave graphics mode and resume<br>

    any previous process.<br>

    gif extension blocks<br>

    to provide for orderly extension of the gif definition, a mechanism<br>

    for defining the packaging of extensions within a gif data stream is<br>

    necessary. specific gif extensions are to be defined and documented by<br>

    compuserve in order to provide a controlled enhancement path.<br>

    gif extension blocks are packaged in a manner similar to that used<br>

    by the raster data though not compressed. the basic structure is:<br>

    7 6 5 4 3 2 1 0 byte #<br>

    +---------------+<br>

    |0 0 1 0 0 0 0 1| 1 '!' - gif extension block introducer<br>

    +---------------+<br>

    | function code | 2 extension function code (0 to 255)<br>

    +---------------+ ---+<br>

    | byte count | |<br>

    +---------------+ |<br>

    : : +-- repeated as many times as necessary<br>

    |func data bytes| |<br>

    : : |<br>

    +---------------+ ---+<br>

    . . . . . .<br>

    +---------------+<br>

    |0 0 0 0 0 0 0 0| zero byte count (terminates block)<br>

    +---------------+<br>

    a gif extension block may immediately preceed any image descriptor<br>

    or occur before the gif terminator.<br>

    all gif decoders must be able to recognize the existence of gif<br>

    extension blocks and read past them if unable to process the function<br>

    code. this ensures that older decoders will be able to process extended<br>

    gif image files in the future, though without the additional<br>

    functionality.<br>

    graphics interchange format (gif) page 9<br>

    appendix a - glossary<br>

    glossary<br>

    pixel - the smallest picture element of a graphics image. this usually<br>

    corresponds to a single dot on a graphics screen. image resolution is<br>

    typically given in units of pixels. for example a fairly standard<br>

    graphics screen format is one 320 pixels across and 200 pixels high.<br>

    each pixel can appear as one of several colors depending on the<br>

    capabilities of the graphics hardware.<br>

    raster - a horizontal row of pixels representing one line of an image. a<br>

    typical method of working with images since most hardware is oriented to<br>

    work most efficiently in this manner.<br>

    lsb - least significant byte. refers to a convention for two byte numeric<br>

    values in which the less significant byte of the value preceeds the more<br>

    significant byte. this convention is typical on many microcomputers.<br>

    color map - the list of definitions of each color used in a gif image.<br>

    these desired colors are converted to available colors through a table<br>

    which is derived by assigning an incoming color index (from the image)<br>

    to an output color index (of the hardware). while the color map<br>

    definitons are specified in a gif image, the output pixel colors will<br>

    vary based on the hardware used and its ability to match the defined<br>

    color.<br>

    interlace - the method of displaying a gif image in which multiple passes<br>

    are made, outputting raster lines spaced apart to provide a way of<br>

    visualizing the general content of an entire image before all of the<br>

    data has been processed.<br>

    b protocol - a compuserve-developed error-correcting file transfer protocol<br>

    available in the public domain and implemented in compuserve vidtex<br>

    products. this error checking mechanism will be used in transfers of<br>

    gif images for interactive applications.<br>

    lzw - a sophisticated data compression algorithm based on work done by<br>

    lempel-ziv &amp; welch which has the feature of very efficient one-pass<br>

    encoding and decoding. this allows the image to be decompressed and<br>

    displayed at the same time. the original article from which this<br>

    technique was adapted is:<br>

    terry a. welch, &quot;a technique for high performance data<br>

    compression&quot;, ieee computer, vol 17 no 6 (june 1984)<br>

    this basic algorithm is also used in the public domain arc file<br>

    compression utilities. the compuserve adaptation of lzw for gif is<br>

    described in appendix c.<br>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -