I am trying to write code to extract Exif information from a JPG.
Exif is stored in the APP1 segment of the JPG file. According to the Exif specification , the APP1 segment format should start as follows:
FF E1
nn nn
45
78
69
66
And this happens until it is FFfollowed by something other than FFor 00.
Looking at the JPG in a hex editor, I see the string FF E1and Exif, but I am unable to decode the length bytes. Example: in one jpg, my hex editor tells me that the APP1 segment is 686 bytes long, but bytes long F7 C8.
How should I use these bytes to print a number from 686?
Edit: Here is the first part of the sample file:
FF D8 FF E1 F7 C8 45 78 69 66 00 00 4D 4D 00 2A 00 00 00 08
: , , , . APP1 "" ? , APP1, . - ?