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
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
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.
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.
One can use https://exiftool.org/ (gratis, portable, works on Microsoft Windows, macOS and Linux).
Demo, running the command exiftool.exe test.png
in cmd
:
Microsoft Windows [Version 10.0.19042.1706]
(c) Microsoft Corporation. All rights reserved.
C:\PortableProgs\exiftool-12.44>"exiftool(-k).exe" test.png
ExifTool Version Number : 12.44
File Name : test.png
Directory : .
File Size : 1837 kB
Zone Identifier : Exists
File Modification Date/Time : 2022:08:07 17:15:39-07:00
File Access Date/Time : 2022:08:07 18:55:55-07:00
File Creation Date/Time : 2022:08:07 18:55:55-07:00
File Permissions : -rw-rw-rw-
File Type : PNG
File Type Extension : png
MIME Type : image/png
Image Width : 2123
Image Height : 1134
Bit Depth : 8
Color Type : RGB with Alpha
Compression : Deflate/Inflate
Filter : Adaptive
Interlace : Noninterlaced
SRGB Rendering : Perceptual
Gamma : 2.2
Pixels Per Unit X : 9448
Pixels Per Unit Y : 9448
Pixel Units : meters
Exif Byte Order : Big-endian (Motorola, MM)
Orientation : Horizontal (normal)
Date/Time Original : 2022:08:07 14:24:32
User Comment : Screenshot
Color Space : sRGB
Exif Image Width : 2160
Exif Image Height : 1620
XMP Toolkit : XMP Core 6.0.0
Date Created : 2022:08:07 14:24:32
Image Size : 2123x1134
Megapixels : 2.4
-- press ENTER --
© 2022 - 2024 — McMap. All rights reserved.