/**
* 图片头部识别标志
*/
image_jpg(ImageTypeEnum.jpg, "ffd8"),
image_bmp(ImageTypeEnum.bmp, "424d"),
image_tiff1(ImageTypeEnum.tiff, "4d4d"),//
image_tiff2(ImageTypeEnum.tiff, "4949"),//
image_png(ImageTypeEnum.png, "89504e470d0a1a0a"),
image_ico(ImageTypeEnum.ico, "0000010001002020"),
image_cur(ImageTypeEnum.cur, "0000020001002020"),
image_gif1(ImageTypeEnum.gif, "474946383961"),//89年版本gif标准,支持动画和扩展属性
image_gif2(ImageTypeEnum.gif, "474946383761"),//87年版本gif标准
image_wmf(ImageTypeEnum.wmf, "d7cdc69a"), //前22个字节是头部
image_emf(ImageTypeEnum.emf, "01"),//@todo 010000006c
image_iff(ImageTypeEnum.iff, "464f524d"),
image_ani(ImageTypeEnum.ani, "52494646"),
image_pcx(ImageTypeEnum.pcx, "0a"),
image_tga1(ImageTypeEnum.tga, "0000020000"),
image_tga2(ImageTypeEnum.tga, "0000100000"),
参考 apache common image 工具包的识别更可靠:
ImageFormat typeEnum = ImageUtil.getImageType(??);