Sets the color of one or more pixels within an image.
img.set()
is easy to use but it's not as fast as img.pixels. Use img.pixels to set many pixel values.
img.set()
interprets the first two parameters as x- and y-coordinates. It interprets the last parameter as a grayscale value, a [R, G, B, A]
pixel array, a p5.Color object, or another p5.Image object.
img.updatePixels() must be called after using img.set()
for changes to appear.
Examples
Syntax
set(x, y, a)
Parameters
x
x-coordinate of the pixel.
y
y-coordinate of the pixel.
Notice any errors or typos? Please let us know. Please feel free to edit src/image/p5.Image.js and open a pull request!