title: What is the simplest RGB image format?
body: <p>I am working in C on a physics experiment, <a href="http://en.wikipedia.org/wiki/Young%27s_interference_experiment" rel="noreferrer">Young's interference experiment</a> and I made a program who prints to <code>file</code> a huge bunch of pixels:</p>
  <pre><code>for (i=0; i &lt; width*width; i++)
  {
      fwrite(hue(raster_matrix[i]), 1, 3, file);
  }
  </code></pre>
  <p>Where <code>hue</code>, when given a value [0..255], gives back a <code>char *</code> with 3 bytes, R,G,B.</p>
  <p>I would like to put a minimal header in my image file in order to make this raw file a <em>valid</em> image file.</p>
  <p>More concise, switching from:</p>
  <pre><code>offset
  0000 : height * width : data } my data, 24bit RGB pixels
  </code></pre>
  <p>to:</p>
  <pre><code>offset
  0000 : dword : magic        \
       : /* ?? */              \
  0012 : dword : height         } Header &lt;--&gt; common image file
  0016 : dword : width         /
       : /* ?? */             /
  0040 : height * width : data  } my data, 24bit RGB pixels
  </code></pre>