a port of the Processing Visualization Language
Name

image()

Examples
example pic

    // @pjs preload must be used to preload the image

    /* @pjs preload="laDefense.jpg"; */

    PImage b;

    b = loadImage("laDefense.jpg");

    image(b, 0, 0);
example pic

    // @pjs preload must be used to preload the image

    /* @pjs preload="laDefense.jpg"; */

    PImage b;

    b = loadImage("laDefense.jpg");

    image(b, 0, 0);

    image(b, 0, 0, width/2, height/2);
Description Diplays images to the screen. The images must be preloaded using @pjs preload before it can be used. Processing currently works with GIF, JPEG, and Targa images. The color of an image may be modified with the tint() function and if a GIF has transparency, it will maintain its transparency. The img parameter specifies the image to display and the x and y parameters define the location of the image from its upper-left corner. The image is displayed at its original size unless the width and height parameters specify a different size. The imageMode() function changes the way the parameters work. A call to imageMode(CORNERS) will change the width and height parameters to define the x and y values of the opposite corner of the image.

NOTE: DOM security will not allow you to load images file:/// URIs. This security can be overridden in Firefox in about:config, by changing security.fileuri.strict_origin_policy to false.
Syntax
image(img, x, y)

image(img, x, y, width, height)
Parameters
img PImage: the image to display
x int or float: x-coordinate of the image
y int or float: y-coordinate of the image
width int or float: width to display the image
height int or float: height to display the image
Usage Web & Application
Related loadImage()
PImage
imageMode()
tint()
background()
alpha()

This reference is licensed under the CC BY-NC-SA 2.0 license:

Creative Commons License
Fork me on GitHub