Each Answer to this Q is separated by one/two green lines.
I load images with numpy/scikit. I know that all images are 200×200 pixels.
When the images are loaded, I notice some have an alpha channel, and therefore have shape (200, 200, 4) instead of (200, 200, 3) which I expect.
Is there a way to delete that last value, discarding the alpha channel and get all images to a nice (200, 200, 3) shape?
Just slice the array to get the first three entries of the last dimension:
image_without_alpha = image[:,:,:3]
from skimage.color import rgba2rgb from skimage import data img_rgba = data.logo() img_rgb = rgba2rgb(img_rgba)