int PictureFormat(TStream *AImage)
{
Word Buffer;
AImage->Position =0;
if(AImage->Size <3) return -1;
AImage->ReadBuffer(&Buffer,2); //
switch(Buffer)
{
case 0x4D42: // bmp
return 0;
case 0xD8FF:// jpg
return 1;
case 0x4947: // gif
return 2;
case 0x5089: //png
return 3;
case 0x4949: //TIFF
return 4;
case 0x050A: //pcx
return 5;
case 0x4238: //psd
return 6;
case 0xA659: //ras
return 7;
case 0xDA01: //SGI
return 8;
case 0:
return 9;
}
return -2;
}
c++ builder 通过文件流获取文件类型
最新推荐文章于 2023-04-30 06:39:40 发布