I've stuck with it for these short little tasks. Maybe you'll find a need for it too. The magic file is a text file that contains some identifying characteristics of a large number of file types. Most files have some key identifier so that other applications can figure out what they are. Linux applications tend to take advantage of that fact, rather than simply relying on the file's extension.
File prints the version number according to that.
Finally, it uses the pairs of bytes at offsets 6 and 8 to display the width and height of the image. See my example output above for the full output for a GIF file example. If you're generating output as part of a program you've developed, you can add its magic info to that file. That's also why I recommend using some magic data in your file, so a user or another program can tell what the data files are. Suppose you're using a login shell that has ls aliased to use some hideous colors that you can't read with your current terminal colors.