If looking at the data structure of a JPG file, this may be more complicated because of the compression algorithms etc.
Rename your JPG with a TXT extension and open the photo with notepad - The output is garbage and meaningless (to me, not the computer) and very random.
The notepad is not the correct was to view the binary data but bear with me ..
Now do the same with a bitmap image (.BMP) and open in notepad - still undecipherable, but you can see the data has some structure and pattern.
Basically, the BMP reads pixel 1 is 'color A' pixel 2 is 'color B' and so on.
With JPG compression, it reads like pixel 1 through to 120 is color A, so I will just save that data, pixels 121 to 145 is Color B etc etc.
So I'm not saying look at the binary in notepad cos that won't work, but maybe you get a better understanding of the structure starting with a bitmap file not a jpg.
Good luck!