1

I have a file that's .gif extension but I suspect that it's a lie and it's actually a webp. What's the best way to know what format the file is?

ajma
  • 12,106
  • 12
  • 71
  • 90

2 Answers2

2

By looking into file content and checking its magic number. For webp it's WEBP and for GIF file it is GIF87a/GIF89a.

Here you have list of all magic numbers and where it is located in file: https://en.wikipedia.org/wiki/List_of_file_signatures

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
  • I used the command here to get the magic number https://stackoverflow.com/a/2147527/60117 – ajma Oct 12 '17 at 22:38
  • I could probably mention `file` but for some reason (you know, SO is developers' site ;) I assumed you need to do that from your code yourself. – Marcin Orlowski Oct 12 '17 at 23:06
0

You can use TrID, an application that uses file contents to determine file type.

JimBoh
  • 21
  • 2