title: How to calculate mean color of image in numpy array?
body: <p>I have an RGB image that has been converted to a numpy array.  I'm trying to calculate the average RGB value of the image using numpy or scipy functions.</p>
  
  <p>The RGB values are represented as a floating point from 0.0 - 1.0, where 1.0 = 255.</p>
  
  <p>A sample 2x2 pixel image_array:</p>
  
  <pre><code>[[[0.0, 0.0, 0.0], [0.0, 0.0, 0.0]],
   [[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]]]
  </code></pre>
  
  <p>I have tried:</p>
  
  <pre><code>import numpy
  numpy.mean(image_array, axis=0)`
  </code></pre>
  
  <p>But that outputs:</p>
  
  <pre><code>[[0.5  0.5  0.5]
   [0.5  0.5  0.5]]
  </code></pre>
  
  <p>What I want is just the single RGB average value:</p>
  
  <pre><code>[0.5  0.5  0.5]
  </code></pre>