First, put the image in the repository (folder) of your project.
Now, we've got a choice. We can display the picture in the webpage using html, or we can put the picture in our Processing program using Java. If you just want a static, non moving picture, it's probably easier to put the image in the html code of the webpage. To put the image on the webpage, I use something like this image html tag <img src="aAHK0LA.png">
in the body of index.html. in this case aAHK0LA.png
is the name of the file I put in my repository.
Here's an example of a non moving picture on the webpage.
If you want to animate the picture or have interact with other objects in the program, you'll probably want to put it in the .pde code file. Here's an example of an animated picture in a processing program
To put the image in a processing program. I need to declare a PImage
variable, initialize it with loadImage()
and draw it to the screen with the image()
function. Here's a simple program that displays a picture:
PImage b; //Declare a PImage named b
void setup()
{
size(450,315);
b = loadImage("http://8s8eke8.jpg"); //loads the image
}
void draw()
{
image(b, 0, 0,450,315); //displays the image with top left corner at (0,0) width of 450 and height of 315
}