title: How to write a JPEG file decoder from scratch
body: <p>I know there are many tools for this already. My goal is to learn.
  So I can read a JPEG file with fopen(), I know this is a binary file.
  Then what? I know that i can learn the JPEG specifications. But it doesn't seem to tell what is the structure of the binary jpeg file. </p>
  
  <p>This file contains zeros and ones
  How can i transform this or how can i know which chain of bits means what ?</p>
  
  <p>I've come across this example: <a href="http://keyj.emphy.de/nanojpeg/" rel="noreferrer">nano jpeg decoder</a>
  But it's pretty hard to read the code</p>
  
  <p>Thanks in advance</p>
  
  <p>PS: <a href="http://www.princeton.edu/~ctralie/Projects/JPEG/jpeg.pdf" rel="noreferrer">This princeton guy has done a project on this which provides a good reference</a></p>