It would be more accurate to say that we will write code that gets the information from a JFIF, or JPEG File Interchange Format. JPEG is not really a file type, but a compression method. JPEG and JFIF are often interchanged. JPEG files are a little more complicated to deal with than GIF files. JPEG files consist of segments, each of which starts with a two-byte marker that identifies the segment type.
Some segments consist only of the marker, while others have data following the marker.
The two-byte marker always contains hexadecimal FF as the first byte. The second byte indicates the marker type. JPEG files start out with a Start of Image, or SOI, segment. The SOI segment consists only of the marker, which is hex FF D8. We will use this to test a file to see if it is a JPEG image.