/* 6.914, Example 3.1 image() and tint()/noTint() 0) Images that you load into your program should be stored either in the "data" folder of your sketch or somewhere on your hard drive. If an image can be found in the C:\Windows\My Documents folder and its title is myImage.JPG, the filepath you'll pass to loadImage is: PImage a = loadImage("C:\\Windows\\My Documents\\myImage.JPG"); Note the double backslashes, double quotes, and case sensitivity. If, instead, the file myImage2.JPG is in your data folder, you can use this parameter: PImage b = loadImage("myImage2.JPG"); Then, display an image by using the image command. image() takes three arguments: PImage, xStart, yStart. Alternatively, it can take five arguments: PImage, xStart, yStart, width, height. Processing currently works with GIF, JPEG, and Targa images. I'm using this image: http://www.aaronovadia.com/clients/photoshopit/display/happyface.gif 1) You can change the coloring of an image using the tint command. Default tint is tint(255, 255, 255); tint takes the RGB(A) or HSB(A) arguments, as with background/fill/stroke, etc. 2) noTint() turns the tint function off. */ void setup(){ size(200, 200); } void draw(){ background(255); noTint(); // remember that draw always loops PImage a = loadImage("happyface.gif"); // load image // resizing window to accomodate image height = a.height; width = a.width; // Displays the image from point (0,0) image(a, 0, 0); //no tint image(a, 0, 0, a.width/2, a.height/2); // cyan tint, from top right tint(100, 255, 255); image(a, width/2, 0, a.width/2, a.height/2); // purple tint and partially transparent, from top left tint(255, 100, 255, 155); image(a, 0, height/2, a.width/2, a.height/2); }