I am trying to create a blank, colored Image in Numpy that includes an alpha channel (RGBA).
In my quest to find out how to do this, I came to this SO answer. However, when I run either example of the SO answer, the red appears blue, unlike the images shown in the answer.
So, I am wondering what the correct way to do this is as uint16 (instead of uint8) and without the color mix-up? Is this a bug with Numpy or am I doing something wrong?
My resulting image: https://i.ibb.co/VVxhDwY/img.png
My code:
import cv2
import numpy as np
size = (128, 256)
blank_image = np.zeros((size[0], size[1], 4), np.uint8)
# Make first 10 rows red and opaque
blank_image[:10] = [255,0,0,255]
# Make first 10 columns green and opaque
blank_image[:,:10] = [0,255,0,255]
cv2.imwrite('test.png', blank_image)

