add a dummy dimension for a multi-dimensional array
Sure, no problem.  Use 'reshape'.  Assuming A1 is a numpy array
A1 = A1.reshape([1,255,255,3])
This will reshape your matrix.
If A1 isn't a numpy array then use
A1 = numpy.array(A1).reshape([1,255,255,3])
There has a nd array A with shape [100,255,255,3], which correspond to 100 255*255 images.  I would like to iterate this multi-dimensional array, and each iteration I get one image. This is what I do, A1 = A[i,:,:,:] The resulting A1 has shape [255,255,3]. However, i would like to enforce it have the shape [1,255,255,3]. How can I do it?