title: How do I convert a 3D image array into a 2D image array in numpy?
body: <p>I have a three-dimensional array of a image stored in a NumPy array. Using an algorithm, I converted the RGB image into <a href="https://en.wiktionary.org/wiki/grayscale#Noun" rel="nofollow noreferrer">grayscale</a>. But in the third dimension the RGB values are same (for gray, the RGB values are same) and I want to convert all the three values into one and thus converting the three-dimensional array into two-dimensional one.</p>
  <p>I.e, the current three-dimensional array is:</p>
  <pre><code>[[[24 24 24] [36 36 36].......[108 108 108]]
   [[196 196 196] [45 45 45] ..... [90 90 90]]
   ...........................................
   ...........................................
   [[80 80 80] [74 74 74] ..........[127 127 127]]]
  </code></pre>
  <p>The 2D array I want is:</p>
  <pre><code>[[24 36 ..........108]
   [196 45 ......... 90]
   [80 74 ..........127]]
  </code></pre>
  <p>How can I achieve this?</p>