title: Export an image using Images in Julia
body: <p>Suppose I have an <code>m</code>-by-<code>n</code>-by-<code>3</code> array of <code>Uint8</code> which represents an image, where an RGB colorspace is assumed. I would like to export it as a 24-bit-per-pixel PNG image using the <code>Images</code> package. How can I do this?</p>
  
  <p>I naively tried to apply <code>imwrite</code> to a randomly-generated raw array, as follows:</p>
  
  <pre><code>imwrite(rand(Uint8,300,300,3),"test.png")
  </code></pre>
  
  <p>However, this gave an error saying "mapinfo has no method mapinfo...".</p>
  
  <p>Likewise, using</p>
  
  <pre><code>imwrite(rand(Float32,300,300,3),"test.png")
  </code></pre>
  
  <p>gave an error saying that it can't infer the colorspace, and that I should use an <code>AbstractImage</code> type instead. So presumably the <code>Images</code> package is not comfortable assuming that an <code>m</code>-by-<code>n</code>-by-<code>3</code> array is automatically an RGB image (the <code>Images</code> documentation cites complications due to the existence of 3D and 4D image types as the reason for not automatically inferring this).</p>
  
  <p>How can I export a numeric array as an image? Can it be done directly, or do I need to create a  wrapper for the array?</p>