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
Integer:

width in pixels.

height
Integer:

height in pixels.

Returns

p5.Image: new p5.Image object.
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