Reputation: 3
I am reading a png image and it is in RGBA format and i would like to remove the 'A' part. The shape of my image is (694, 1077, 4) but I would like it to be (694, 1077, 3). I'd like to remove the last column in the array so I only have RGB values.
Upvotes: 0
Views: 121
Reputation: 11860
You can use the mode='RGB'
parameter (see docs), which should omit the alpha band.
Upvotes: 0
Reputation: 892
nd = np.random.randn(60).reshape(3,4,5)
print nd
print nd[:,:,:nd.shape[2]-1].shape #(3L, 4L, 4L)
This will take out the last column.
Upvotes: 0