Reference createImage()

createImage()

Creates a new p5.Image object.

createImage() uses the width and height parameters to set the new p5.Image object's dimensions in pixels. The new p5.Image can be modified by updating its pixels array or by calling its get() and set() methods. The loadPixels() method must be called before reading or modifying pixel values. The updatePixels() method must be called for updates to take effect.

Note: The new p5.Image object is transparent by default.

Examples

Syntax

createImage(width, height)

Parameters

width

width in pixels.

height

height in pixels.

Notice any errors or typos? Please let us know. Please feel free to edit src/image/image.js and open a pull request!

Related References