Viewing a single comment thread. View all comments

lucky_ducker t1_ixubbvq wrote

The file extension is just a suggestion to the OS what application should be used to open the file, and you can change the file association if you want. On Windows, you use the Default Apps applet to change specific file extensions to be associated with specific applications.

The real format information is in the metadata of the file itself, the first few bytes of the data. For example, if the first two bytes of a file are MZ the file is a DOS/Windows executable file (MZ are the initials of the guy who designed the file format).

JPG and JPEG files have, for some time and for the most part, been saved in the JFIF format internally. If you open a JPG file in a hex editor or programmer's text editor, you'll see somewhere around byte offset 0x7 the characters JFIF indicating that the file is actually in that format. Likewise PDF files have PDF in about the same position.

1