为什么有的gif图像只能读出一部分数据?
同样的程序,一副图像可以读出它的全局色彩表(Globle color Table),而有的图像却只能读出全局色彩表的一部分,后面的数据全为0,到底为什么啊?对于一副gif图像,可以用UltraEdit-32打开
#include<stdio.h>
int main()
{
FILE *fp;
unsigned char Hd[6]={};
unsigned char LGC[7]={};
unsigned char GCT[768]={};
unsigned char CrlE[8]={};
unsigned char ImgD[10]={};
unsigned char T_B_minicode[10]={};
unsigned char T_B_data[]={};
int i,j;
fp=fopen("f.gif","r");
fread(Hd,sizeof(char),6,fp); /*read gif head*/
printf("The GIF Header is:\n");
for(i=0;i<6;i++) /*show head in stdout*/
printf("%c",Hd[i]);
printf("\nThe GIF LogicBlock is:\n");
fread(LGC,sizeof(unsigned char),7,fp);
for(i=0;i<7;i++)
printf("%x\t",LGC[i]);
printf("\n");
printf("The Globle color Table is:\n");
fread(GCT,sizeof(char),768,fp);
for(i=0;i<768;i++)
printf("%x\t",GCT[i]);
printf("\n");
printf("The Contrl Extension is:\n");
fread(CrlE,sizeof(unsigned char),8,fp);
for(i=0;i<8;i++)
printf("%x\t",CrlE[i]);
printf("\n");
printf("The Image Descriptor is:\n");
fread(ImgD,sizeof(unsigned char),10,fp);
for(i=0;i<10;i++)
printf("%x\t",ImgD[i]);
printf("\n");
printf("The Table Based Image Date is:\n");
fread(T_B_minicode,sizeof(unsigned char),10,fp);
for(i=0;i<9;i++)
printf("%x\t",T_B_minicode[i]);
printf("\n");
fclose(fp);
return 0;
}