Py5Image.update_np_pixels()

Py5Image.update_np_pixels()#

Updates the image with the data in the Py5Image.np_pixels[] array.

Examples#

example picture for update_np_pixels()

def setup():
    my_image = py5.load_image("apples.jpg")
    my_image.load_np_pixels()
    my_image.np_pixels[:50, :, :] = my_image.np_pixels[50:100, :, :]
    my_image.update_np_pixels()
    py5.image(my_image, 0, 0)

Description#

Updates the image with the data in the Py5Image.np_pixels[] array. Use in conjunction with Py5Image.load_np_pixels(). If you’re only reading pixels from the array, there’s no need to call update_np_pixels() — updating is only necessary to apply changes.

The update_np_pixels() method is similar to Py5Image.update_pixels() in that update_np_pixels() must be called after modifying Py5Image.np_pixels[] just as Py5Image.update_pixels() must be called after modifying Py5Image.pixels[].

Signatures#

update_np_pixels() -> None

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