Ikkster Ikkster - 1 year ago 75
Python Question

How do you delete an entire column of values from an ndarray obtained from misc.imread()?

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.

Answer Source

Simply do this:

im_without_A = im[:, :, :3]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download