如何确定图像的编码

Ban*_*San 5 encoding png image gif bmp

我有一个带有PNG扩展名的图像。

我怀疑它实际上不是PNG(我认为它可能是GIF)。

如何确认图像的编码?

注意: Windows的解决方案更可取

Qua*_*tim 6

在 Linux 上,您可以使用file命令

$ file branches.gif
branches.gif: PNG image data, 1257 x 782, 8-bit/color RGBA, non-interlaced
Run Code Online (Sandbox Code Playgroud)

或称为 imagemagic 部分 identify

identify branches.gif
branches.gif PNG 1257x782 1257x782+0+0 8-bit sRGB 114KB 0.000u 0:00.000
Run Code Online (Sandbox Code Playgroud)


Mal*_*ean 4

您需要快速检查文件的内部结构。

PNG 图像的前 8 个字节始终是

137 80 78 71 13 10 26 10

非恶意非 PNG 具有相同的 8 个字节的可能性微乎其微。