title: Save float * images in C++
body: <p>I wanted to understand how I can save an image of type <code>float</code>: </p>
  
  <pre><code>float * image;
  </code></pre>
  
  <p>Allocated in this way:</p>
  
  <pre><code>int size = width * height;
  image = (float *)malloc(size * sizeof(float));
  </code></pre>
  
  <p>I tried using the CImg library, but does not accept float directly. Infact, i only use it  to capture image to float, because I need only float images.</p>
  
  <pre><code>CImg&lt;float&gt; image("image.jpg");
  int width = image.width(); 
  int height = image.height();
  int size = width*height
  float * image = image.data();
  </code></pre>
  
  <p>How do I save this picture to <code>float</code> from <code>.jpg</code> or <code>.bmp</code> readable. I thought to open a write buffer but not save me anything and I can not read from a file!</p>