Loads the pixel data of the image into the Py5Image.np_pixels array.
1def setup(): 2 my_image = py5.load_image("apples.jpg") 3 my_image.load_np_pixels() 4 my_image.np_pixels[:50, :, :] = my_image.np_pixels[50:100, :, :] 5 my_image.update_np_pixels() 6 py5.image(my_image, 0, 0)
Loads the pixel data of the image into the Py5Image.np_pixels array. This method must always be called before reading from or writing to Py5Image.np_pixels. Subsequent changes to the image will not be reflected in Py5Image.np_pixels until
py5image_load_np_pixels() is called again.
load_np_pixels() method is similar to Py5Image.load_pixels() in that
load_np_pixels() must be called before reading from or writing to Py5Image.np_pixels just as Py5Image.load_pixels() must be called before reading from or writing to Py5Image.pixels.
load_np_pixels() will as a side effect call Py5Image.load_pixels(), so if your code needs to read Py5Image.np_pixels and Py5Image.pixels simultaneously, there is no need for a separate call to Py5Image.load_pixels(). However, be aware that modifying both Py5Image.np_pixels and Py5Image.pixels simultaneously will likely result in the updates to Py5Image.pixels being discarded.
load_np_pixels() -> None
Updated on September 11, 2021 16:51:34pm UTC