#Read in channel's pixels
red_pixels = np.zeros(width * height, np.float32)
red.readPixels(0, 0, width, height, red_pixels)
green_pixels = np.zeros(width * height, np.float32)
green.readPixels(0, 0, width, height, green_pixels)
blue_pixels = np.zeros(width * height, np.float32)
blue.readPixels(0, 0, width, height, blue_pixels)
#Reshape to image dimensions
red_pixels.shape = height, width
green_pixels.shape = height, width
blue_pixels.shape = height, width
#Combine into a RGB image
rgb=np.zeros((height,width,3))
rgb[...,0] = red_pixels
rgb[...,1] = green_pixels
rgb[...,2] = blue_pixels
numpy
rgb2 = ((np.clip(rgb.copy(),0,1))*255).astype('uint8')
#Reverse Red-Blue Channels as open cv will reverse again upon writing image on disk
cv2.imwrite('image_name.jpg',rgb2[...,::-1])