load_pixels()

load_pixels()#

Loads the pixel data of the current display window into the pixels[] array.

Examples#

example picture for load_pixels()

def setup():
    half_image = py5.width*py5.height//2
    my_image = py5.load_image("apples.jpg")
    py5.image(my_image, 0, 0)
    
    py5.load_pixels()
    for i in range(0, half_image):
        py5.pixels[i+half_image] = py5.pixels[i]
    
    py5.update_pixels()

Description#

Loads the pixel data of the current display window into the pixels[] array. This function must always be called before reading from or writing to pixels[]. Subsequent changes to the display window will not be reflected in pixels[] until load_pixels() is called again.

Underlying Processing method: loadPixels

Signatures#

load_pixels() -> None

Updated on March 06, 2023 02:49:26am UTC