Celeb Glow
general | March 02, 2026

How do I check the actual format of an image file?

I have a bunch of image files with the extension ".png", but I'm fairly sure some of them are actually JPEGs that were renamed to PNGs. As far as I know, simply renaming the file doesn't actually change the formatting, compression, etc., so how do I check which are formatted accordingly to their extensions?

Plus, does XnConvert actually convert the images' format?

1

2 Answers

If you have either a Linux system, or WSL (on Windows) you could type

file myimagewithoutextension

Output:

myimagewithoutextension: JPEG image data, JFIF standard 1.01, resolution (DPI), density 96x96, segment length 16, baseline, precision 8, 768x576, frames 3

The file command completely ignores the file extension, but rather relies on information in the file header.

Alternatively, open the suspected PNG in Notepad. If it's truly a PNG, it will have ‰PNG on the first line. Jpeg's will have JFIF somewhere near the start.

enter image description here

2

How do I check which are formatted accordingly to their extensions?

You can use ImageMagick for this. ImageMagick is available for Windows, Mac and Linux. You will typically want one of the "DLL" versions for Windows (not one of the "Static" versions).

Once installed, you can identify images with incorrect extensions with ex. magick identify file.ext:

Example

# Should be a .jpg, not a .png
magick identify it-kama-sutra.png
it-kama-sutra.png JPEG 500x397 500x397+0+0 8-bit sRGB 37707B 0.000u 0:00.060
# Should be a .gif, not a .png
magick identify giphy.png
giphy.png[0] GIF 346x255 346x255+0+0 8-bit sRGB 256c 0.000u 0:00.062
giphy.png[1] GIF 346x255 346x255+0+0 8-bit sRGB 256c 0.000u 0:00.087
giphy.png[2] GIF 346x255 346x255+0+0 8-bit sRGB 256c 0.000u 0:00.092
[...]
giphy.png[13] GIF 346x255 346x255+0+0 8-bit sRGB 256c 0.000u 0:00.237
giphy.png[14] GIF 346x255 346x255+0+0 8-bit sRGB 256c 0.000u 0:00.329
giphy.png[15] GIF 346x255 346x255+0+0 8-bit sRGB 256c 716527B 0.000u 0:00.336

Note that on Windows, you need to add magick.exe (magick) to your Windows path to use it without specifying its exact location (ex. C:\path\to\imagemagick\magick.exe).

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy