Name

image()

Examples
# Images must be in the "data" directory to load correctly
img = loadImage("laDefense.jpg")
image(img, 0, 0)
# Images must be in the "data" directory to load correctly
img = loadImage("laDefense.jpg")
image(img, 0, 0)
image(img, 0, 0, width / 2, height / 2)
Description The image() function draws an image to the display window. Images must be in the sketch's "data" directory to load correctly. Select "Add file..." from the "Sketch" menu to add the image to the data directory, or just drag the image file onto the sketch window. Processing currently works with GIF, JPEG, and PNG images.

The img parameter specifies the image to display and by default the a and b parameters define the location of its upper-left corner. The image is displayed at its original size unless the c and d parameters specify a different size. The imageMode() function can be used to change the way these parameters draw the image.

The color of an image may be modified with the tint() function. This function will maintain transparency for GIF and PNG images.
Syntax
image(img, a, b)
image(img, a, b, c, d)
Parameters
imgPImage: the image to display
afloat: x-coordinate of the image
bfloat: y-coordinate of the image
cfloat: width to display the image
dfloat: height to display the image
Related loadImage()
PImage
imageMode()
tint()
background()
alpha()

Updated on Tue Feb 27 14:07:12 2024.

If you see any errors or have comments, please let us know.