小弟我最近想写一个可以把多张静态图合成一张GIF动态图的程序.最好还能实现在不同的真间设置播放间隔时间.不知道如何入手,请高手赐教啊!!
谢谢!

解决方案 »

  1.   

    Wow, it appears that Compuserve released something to actually help people use GIF. However, note their copyright restrictions: 
    Code: 
                                    G I F (tm) 
                         Graphics Interchange Format (tm) 
                          A standard defining a mechanism 
                         for the storage and transmission 
                       of raster-based graphics information 
                                   June 15, 1987 
                         (c) CompuServe Incorporated, 1987 
                                All rights reserved 
                While this document is copyrighted, the information 
              contained within is made available for use in computer 
              software without royalties, or licensing restrictions. 
              GIF and 'Graphics Interchange Format' are trades of 
                             CompuServe, Incorporated. 
                               an H&R Block Company 
                            5000 Arlington Centre Blvd. 
                               Columbus, Ohio 43220 
                                  (614) 457-8600 
                                                                         Page 2 
                  Graphics Interchange Format (GIF) Specification 
                                 Table of Contents 
            INTRODUCTION . . . . . . . . . . . . . . . . . page 3 
            GENERAL FILE FORMAT  . . . . . . . . . . . . . page 3 
            GIF SIGNATURE  . . . . . . . . . . . . . . . . page 4 
            SCREEN DESCRIPTOR  . . . . . . . . . . . . . . page 4 
            GLOBAL COLOR MAP . . . . . . . . . . . . . . . page 5 
            IMAGE DESCRIPTOR . . . . . . . . . . . . . . . page 6 
            LOCAL COLOR MAP  . . . . . . . . . . . . . . . page 7 
            RASTER DATA  . . . . . . . . . . . . . . . . . page 7 
            GIF TERMINATOR . . . . . . . . . . . . . . . . page 8 
            GIF EXTENSION BLOCKS . . . . . . . . . . . . . page 8 
            APPENDIX A - GLOSSARY  . . . . . . . . . . . . page 9 
            APPENDIX B - INTERACTIVE SEQUENCES . . . . . . page 10 
            APPENDIX C - IMAGE PACKAGING & COMPRESSION . . page 12 
            APPENDIX D - MULTIPLE IMAGE PROCESSING . . . . page 15 
    Graphics Interchange Format (GIF)                                    Page 3 
    Specification 
    INTRODUCTION 
            'GIF' (tm) is CompuServe's standard for defining generalized  color 
       raster   images.    This   'Graphics  Interchange  Format'  (tm)  allows 
       high-quality, high-resolution graphics to be displayed on a  variety  of 
       graphics  hardware  and is intended as an exchange and display mechanism 
       for graphics images.  The image format described  in  this  document  is 
       designed  to  support  current  and  future image technology and will in 
       addition serve as a basis for future CompuServe graphics products. 
            The main focus  of  this  document  is  to  provide  the  technical 
       information  necessary  for  a  programmer to implement GIF encoders and 
       decoders.  As such, some assumptions are made as to terminology relavent 
       to graphics and programming in general. 
            The first section of this document describes the  GIF  data  format 
       and its components and applies to all GIF decoders, either as standalone 
       programs or as part of  a  communications  package.   Appendix  B  is  a 
       section  relavent to decoders that are part of a communications software 
       package and describes the protocol requirements for entering and exiting 
       GIF mode, and responding to host interrogations.  A glossary in Appendix 
       A defines some of the terminology used in  this  document.   Appendix  C 
       gives  a  detailed  explanation  of  how  the  graphics  image itself is 
       packaged as a series of data bytes. 
                    Graphics Interchange Format Data Definition 
     GENERAL FILE FORMAT 
            +-----------------------+ 
            | +-------------------+ | 
            | |   GIF Signature   | | 
            | +-------------------+ | 
            | +-------------------+ | 
            | | Screen Descriptor | | 
            | +-------------------+ | 
            | +-------------------+ | 
            | | Global Color Map  | | 
            | +-------------------+ | 
            . . .               . . . 
            | +-------------------+ |    ---+    
            | |  Image Descriptor | |       |    
            | +-------------------+ |       |    
            | +-------------------+ |       |  
            | |  Local Color Map  | |       |-   Repeated 1 to n times 
            | +-------------------+ |       |    
            | +-------------------+ |       |    
            | |    Raster Data    | |       |    
            | +-------------------+ |    ---+    
            . . .               . . .    
            |-    GIF Terminator   -|    
            +-----------------------+ 
    Graphics Interchange Format (GIF)                                    Page 4
      

  2.   

    Graphics Interchange Format (GIF)                                    Page 4 
    Specification 
     GIF SIGNATURE 
            The following GIF Signature identifies  the  data  following  as  a 
       valid GIF image stream.  It consists of the following six characters: 
                 G I F 8 7 a 
            The last three characters '87a' may be viewed as a  version  number 
       for  this  particular  GIF  definition  and will be used in general as a 
       reference  in  documents  regarding  GIF  that   address   any   version 
       dependencies. 
     SCREEN DESCRIPTOR 
            The Screen Descriptor describes the overall parameters for all  GIF 
       images  following.  It defines the overall dimensions of the image space 
       or logical screen required, the existance of color mapping  information, 
       background  screen color, and color depth information.  This information 
       is stored in a series of 8-bit bytes as described below. 
                  bits 
             7 6 5 4 3 2 1 0  Byte # 
            +---------------+ 
            |               |  1 
            +-Screen Width -+      Raster width in pixels (LSB first) 
            |               |  2 
            +---------------+ 
            |               |  3 
            +-Screen Height-+      Raster height in pixels (LSB first) 
            |               |  4 
            +-+-----+-+-----+      M = 1, Global color map follows Descriptor 
            |M|  cr |0|pixel|  5   cr+1 = # bits of color resolution 
            +-+-----+-+-----+      pixel+1 = # bits/pixel in image 
            |   background  |  6   background=Color index of screen background 
            +---------------+          (color is defined from the Global color 
            |0 0 0 0 0 0 0 0|  7        map or default map if none specified) 
            +---------------+ 
            The logical screen width and height can both  be  larger  than  the 
       physical  display.   How  images  larger  than  the physical display are 
       handled is implementation dependent and can take advantage  of  hardware 
       characteristics  (e.g.   Macintosh scrolling windows).  Otherwise images 
       can be clipped to the edges of the display. 
            The value of 'pixel' also defines  the  maximum  number  of  colors 
       within  an  image.   The  range  of  values  for 'pixel' is 0 to 7 which 
       represents 1 to 8 bits.  This translates to a range of 2 (B & W) to  256 
       colors.   Bit  3 of word 5 is reserved for future definition and must be 
       zero. 
    Graphics Interchange Format (GIF)                                    Page 5 
    Specification 
     GLOBAL COLOR MAP 
            The Global Color Map is optional but recommended for  images  where 
       accurate color rendition is desired.  The existence of this color map is 
       indicated in the 'M' field of byte 5 of the Screen Descriptor.  A  color 
       map  can  also  be associated with each image in a GIF file as described 
       later.  However this  global  map  will  normally  be  used  because  of 
       hardware  restrictions  in equipment available today.  In the individual 
       Image Descriptors the 'M' flag will normally be  zero.   If  the  Global 
       Color  Map  is  present,  it's definition immediately follows the Screen 
       Descriptor.   The  number  of  color  map  entries  following  a  Screen 
       Descriptor  is equal to 2**(# bits per pixel), where each entry consists 
       of three byte values representing the relative intensities of red, green 
       and blue respectively.  The structure of the Color Map block is: 
                  bits 
             7 6 5 4 3 2 1 0  Byte # 
            +---------------+ 
            | red intensity |  1    Red value for color index 0 
            +---------------+ 
            |green intensity|  2    Green value for color index 0 
            +---------------+ 
            | blue intensity|  3    Blue value for color index 0 
            +---------------+ 
            | red intensity |  4    Red value for color index 1 
            +---------------+ 
            |green intensity|  5    Green value for color index 1 
            +---------------+ 
            | blue intensity|  6    Blue value for color index 1 
            +---------------+ 
            :               :       (Continues for remaining colors) 
            Each image pixel value received will be displayed according to  its 
       closest match with an available color of the display based on this color 
       map.  The color components represent a fractional intensity  value  from 
       none  (0)  to  full (255).  White would be represented as (255,255,255), 
       black as (0,0,0) and medium yellow as (180,180,0).  For display, if  the 
       device  supports fewer than 8 bits per color component, the higher order 
       bits of each component are used.  In the creation of  a  GIF  color  map 
       entry  with  hardware  supporting  fewer  than 8 bits per component, the 
       component values for the hardware  should  be  converted  to  the  8-bit 
       format with the following calculation: 
            <map_value> = <component_value>*255/(2**<nbits> -1) 
            This assures accurate translation of colors for all  displays.   In 
       the  cases  of  creating  GIF images from hardware without color palette 
       capability, a fixed palette should be created  based  on  the  available 
       display  colors for that hardware.  If no Global Color Map is indicated, 
       a default color map is generated internally  which  maps  each  possible 
       incoming  color  index to the same hardware color index modulo <n> where 
       <n> is the number of available hardware colors. 
    Graphics Interchange Format (GIF)                                    Page 6
      

  3.   

    谢谢楼上的.有关GIF格式的介绍我已经看过了.但不知如何入手,有哪位高手有相关的经验或好的方法介绍一下吗?最好能有个Sample.谢谢
      

  4.   

    CxImage is a C++ class to load, save, display, transform BMP, JPEG, GIF, PNG, TIFF, MNG, ICO, PCX, TGA, WMF, WBMP, JBG, J2K images.  因此,用CxImage吧,网上可以下载,免费。
      

  5.   

    好像在GDIPLUS里也可以实现GIF的读取,显示.转换.但不知道它有没有提供对动态GIF动画的支持.有高人了解吗?
      

  6.   

    CXIMAGE好像没有提供这种合成动态GIF的方法吧.有人作过这种功能吗?