Adding alpha channel to RGB array using numpy
<p>I have an image array in RGB space and want to add the alpha channel to be all zeros. Specifically, I have a <code>numpy</code> array with shape (205, 54, 3) and I want to change the shape to (205, 54, 4) with the additional spot in the third dimension being all 0.0's. Which numpy operation would achieve this?</p>

<p>You could use one of the stack functions (<a href="http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.stack.html" rel="nofollow">stack</a>/<a href="http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.hstack.html" rel="nofollow">hstack</a>/<a href="http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.vstack.html" rel="nofollow">vstack</a>/<a href="http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.dstack.html" rel="nofollow">dstack</a>/<a href="http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.concatenate.html" rel="nofollow">concatenate</a>) to join multiple arrays together.</p>

<pre><code>numpy.dstack( ( your_input_array, numpy.zeros((25, 54)) ) )
</code></pre>

python numpy