title: Combine arrays to raster (jpeg)
body: <p>I am trying all day combine three ndarrays to one jpeg picture. I extract three bands using gdal library. Exported values are in array, looks like this:</p>
  <pre><code>[[ 6355.  6586.  6646. ...,   704.   671.   725.]
   [ 5853.  6031.  6107. ...,   782.   813.   897.]
   [ 4632.  4748.  4305. ...,   837.   869.   802.]
   ..., 
   [ 1032.  1090.  1018. ...,  1500.  1441.  1387.]
   [  958.   980.   913. ...,  1522.  1455.  1391.]
   [  883.   932.   966. ...,  1489.  1369.  1378.]]
  </code></pre>
  <p>This is one extracted band from pix file. I have three bands. Here I am trying combine this bands:</p>
  <pre><code>rgbArray = np.zeros((rows,cols,3), dtype=np.uint8)
  band1 = dataset.GetRasterBand(closest_channel(dict_channel, 640)-1)
  band2 = dataset.GetRasterBand(closest_channel(dict_channel, 550)-1)
  band3 = dataset.GetRasterBand(closest_channel(dict_channel, 460)-1)
  data1 = band1.ReadAsArray (0, 0, cols, rows).astype(np.float)
  data2 = band2.ReadAsArray (0, 0, cols, rows).astype(np.float)
  data3 = band3.ReadAsArray (0, 0, cols, rows).astype(np.float)
  rgbArray[..., 0] = data1
  rgbArray[..., 1] = data2
  rgbArray[..., 2] = data3
  img = Image.fromarray(rgbArray, 'RGB')
  </code></pre>
  <p>and the picture looks like this:
  <a href="https://i.stack.imgur.com/zwG2C.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zwG2C.jpg" alt="enter image description here" /></a></p>
  <p>Of course it is not good result. It should be picture taking from plane on the ground where should be field.</p>
  <p>I will be very glad for any, any help
  Thanks a lot</p>