What is the correct way to change image channel ordering between channels first and channels last?
I agree with @Qualia ‘s comment, np.moveaxis(a, source, destination) is easier to understand. This does the job: x = np.zeros((12, 12, 3)) x.shape #yields: (12, 12, 3) x = np.moveaxis(x, -1, 0) x.shape #yields: (3, 12, 12)