Processing.js

Displaying

This code was updated from the Java source to work with Processing.js asynchronous image loading. - F1LT3R

Images can be displayed to the screen at their actual size or any other size.

Original Processing.org Example: Displaying

// All Examples Written by Casey Reas and Ben Fry
// unless otherwise stated.
/* @pjs preload="data/jelly.jpg"; */

size(200, 200);
PImage a;  // Declare variable "a" of type PImage
a = loadImage("data/jelly.jpg");  // Load the images into the program
image(a, 0, 0); // Displays the image from point (0,0) when image data has been loaded
image(a, width/2, 0, a.width/2, a.height/2);