import numpy import cv2 img_array = [[[0,255,255,50] for i in range (50)] for j in range (50)] img_numpy = numpy.array(img_array) cv2.imwrite("1.jpg",img_numpy)