for example, at present, all pixel values of the image can only be obtained by traversing the loop:
image = Image.open("test.png")
width = image.width
height = image.height
image_list = []
for x in range(height):
scanline_list = []
for y in range(width):
pixel = image.getpixel((y, x))
scanline_list.append(pixel)
image_list.append(scanline_list)
print(image_list)
is there an easier way to get all the pixels of an image? Similar to returning a list of all pixels of an image directly with the getpixels ()
method