Loads the pixel data of the image into the Py5Image.np_pixels array.
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)
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 March 06, 2023 02:49:26am UTC