title: How to write an array of floats as Image in julia by using Images.jl
body: <p>I need to read an image, manipulate it a bit and then save it as image again. To do that, I've found the excellent Images.jl package in julia. I was able to read image, convert it to Floating point array and then  manipulate it (cropping image and changing some values on the image). However, I could not find a way to store it as a jpg. file again. Here is the process I apply to manipulate the data. For the code below, let's assume I have an <em>dog.jpg</em> file in the same directory.</p>
  
  <pre><code>Using Images,Colors
  averageImage = zeros(1,1,3)
  averageImage[1,1,:] = [123.68 116.779 103.779]
  function data(img, averageImage)
             a0 = load(img)
             new_size = ntuple(i-&gt;div(size(a0,i)*224,minimum(size(a0))),2)
             a1 = Images.imresize(a0, new_size)
             i1 = div(size(a1,1)-224,2)
             j1 = div(size(a1,2)-224,2)
             b1 = a1[i1+1:i1+224,j1+1:j1+224]
             c1 = separate(b1)
             d1 = convert(Array{Float32}, c1)
             e1 = reshape(d1[:,:,1:3], (224,224,3,1))
             f1 = (255 * e1 .- averageImage)
             g1 = permutedims(f1, [2,1,3,4])
             g1 = g1[:,:,:]
             # here type of g1 is : Array{Float64,3}
         end
  
  A = data("dog.jpg",averageImage)
  </code></pre>
  
  <p>Here, I was able to get A. Now, I need to save that A array as image. 
  To to that, I try the following :</p>
  
  <pre><code>save("modified_dog.jpg",A) 
  </code></pre>
  
  <p>I got the following error:</p>
  
  <blockquote>
    <p>ERROR: ArgumentError: FixedPointNumbers.UFixed{UInt8,8} is an 8-bit
    type representing 256 values from 0.0 to 1.0; cannot represent -79.68</p>
  </blockquote>
  
  <p>Unfortunatelly, I do not know to do that conversion. </p>
  
  <p>Is there anyone to help me to save the mentioned A array ? Thanks in advance. </p>