你生成的gif是正确的吗?在acdsee里动吗?

解决方案 »

  1.   

    在研究中
    我看了文件结构了。
    这是gif文件头的类
    class GIFhead
    {
      protected $ver;     //GIF文件标识,GIF文件版本号,占6个字节
      protected $width;   //像素数,定义GIF图象的宽度,占2个字节
      protected $height;  //像素数,定义GIF图象的高度,占2个字节
      protected $screen;  //该字字为标志字节,具体如下,占1个字节
        protected $m;       //全局颜色列表标志(Global Color Table Flag),
                            //当置位时表示有全局颜色列表,pixel值有意义.占一位,可以用<<左移出来
        //具体见screen_bit()函数
        protected $cr;       //颜色深度(Color ResoluTion),cr+1确定图象的颜色深度.占3位
        protected $s;        //分类标志(Sort Flag),如果置位表示全局颜色列表分类排列占1位.
        protected $pixel;    //全局颜色列表大小,pixel+1确定颜色列表的索引数(2的pixel+1次方)占3位
      protected $background;
      protected $aspect;
      public function __construct(&$content)
      {
         $this->ver=substr($content,0,5);
     $this->width=ord($content{6}.$content{7});
     $this->height=ord($content{8}.$content{9});
     $this->screen=ord($content{10});
     $this->screen_bit();
     $this->background=ord($content{11});
     $this->aspect=ord($content{12});
      }
      public function screen_bit()
      {
         $this->m=$this->screen<<1?1:0;      //取出一位  
     $this->screen=$this->screen&0x7f;   //保留剩下的
     $this->cr=($this->screen&0x70)>>4;  //取出3位色深
     $this->s=($this->screen&0x08)?1:0;  //取出分类标志
     $this->pixel=$this->screen&0x07;    //取出最后三位
      }
      public function getVer()
      {
         return $this->ver;
      }
      public function getWidth()
      {
         return $this->width;
      }
      public function getHeight()
      {
        return $this->height;
      }
      public function getScreen($var='')
      {
     if($var!='')
     {
       return $this->$var;
     }else
     {
           return $this->screen;
         }
      }
      public function getBackground()
      {
        return $this->background;
      }
    }
      

  2.   

    再下面就是颜色数组,也就是调色板。
    再后就是数据。因为gif用了lzw算法。
    我现在还弄得怎么明白。在网上查下又没有其它程现成的算法可看。
      

  3.   

    因为语文有点差
    正在研究这段文字
    http://www.whsdn.net/bbs/default.aspx?p=thread&ForumID=30&ThreadID=36&View=New&Page=1