How many bytes of memory is used just to "acknowledge" that a certain file is a .jpg? I'm rather new to computers and how they work in the microscopic scale, but here's the little bit that I know.


  Computers have lots of transistors in them, both in memory and processor, and each transistor has two states, on and off. They are translated to binary equivalents 0 and 1. All data is stored in computers as combinations of 0s and 1s. Each 0 or a 1 is called a bit, and 8 bits make up a byte. A single byte is too small so units like kilobytes, megabytes, and gigabytes are more common.


I know that .jpg images occupy some memory in the computer, usually in the orders of kilobytes. However, the computer must know that the 0s and 1s that make up the image are for the image, and the computer must acknowledge this. In order to inform the computer that these 0s and 1s are assigned for a .jpg image, there must be a few bytes of data to inform that the rest of the bytes are a part of the image file. How many bytes would just acknowledging the file type take?
Depends on how accurately you want it to be. 

If you trust the extension then all you need is the 4 last characters in the file name (32 bits)

If you trust the magic header number then you need to check the file starts with 3 bytes ff d8 ff (24 bits). Though other file types have different sizes of magic number. There is a (non-exhaustive) list of them on wikipedia.

If you want to make sure the file is an actual image then you need to actually decode it. Here the size depends on the file size.