I have an image with a PNG extension.
I suspect it's not really a PNG though (I think it might be a GIF).
How can I confirm an image's encoding?
NB: A solution for Windows would be preferable
on Linux, you can use file
command
$ file branches.gif
branches.gif: PNG image data, 1257 x 782, 8-bit/color RGBA, non-interlaced
or ImageMagick part called identify
identify branches.gif
branches.gif PNG 1257x782 1257x782+0+0 8-bit sRGB 114KB 0.000u 0:00.000
You need to do a quick check of the file's internals.
The first 8 bytes of a PNG image are always
137 80 78 71 13 10 26 10
It is vanishingly unlikely that a non-malicious non-PNG has the same 8 bytes.
For windows open the file in a text editor, e.g. Sublime, and the first part should be the png magic number 89 50 4e 47 0d 0a 1a 0a.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With