JPEG format

Byte Order: Big-endian
Offset   Length   Contents
  0      1 byte   0xff
  1      1 byte   0xd8 (SOI)
  2      1 byte   0xff
  3      1 byte   0xe0 (APP0)
  4      2 bytes  length of APP0 block
  6      5 bytes  "JFIF\0"
 11      1 byte   <Major version>
 12      1 byte   Minor version
 13      1 byte   <Units for the X and Y densities>
                     units = 0:  no units, X and Y specify the pixel aspect ratio
                     units = 1:  X and Y are dots per inch
                     units = 2:  X and Y are dots per cm
 14      2 bytes  <Xdensity:   Horizontal pixel density>
 16      2 bytes  <Ydensity:   Vertical pixel density>
 18      1 byte   <Xthumbnail: Thumbnail horizontal pixel count>
 19      1 byte   <Ythumbnail: Thumbnail vertical pixel count>

                 ...

         1 byte  0xff
         1 byte  0xd9 (EOI) end-of-file