How does Python Pillow get all the pixels of an image?

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


image itself represents a two-dimensional array of pixels, so it is not necessary to save a two-dimensional array as an one-dimensional array. I think the subject might as well tell us what it takes to get an one-dimensional array of picture pixels.
in addition, pillow has a method to directly obtain a two-dimensional array of pixels:

  refer to the pillow documentation . 
I hope I can help you.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4c1e4-4c592.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4c1e4-4c592.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?