Added function to convert ndarray to 3 channels from 4 and vice-versa