7. PImage Class
• A subclass of PGraphics
• We declare and initialize a PImage just like any
other class:!
PImage img;
img = loadImage(“filename.png”);
PImage img = loadImage(“filename.png”);
8. loadImage()
• loadImage() calls the constructor for us!
• createImage() creates a blank image (all 0’s)!
• Don’t use it in the draw loop (use it in setup)!
• Like any other class, you can store many images
in a PImage[]
• You must provide a filename or URL
12. The pixels[] Array
• We can load the pixels array of our sketch
window with loadPixels()
• We can load the pixels of any image with
img.loadPixels()
• We can manipulate those pixels, and then save
them with updatePixels() img.updatePixels()
16. For next time…
• Read Shiffman, pp. 264–274 (Images II)!
• Homework 4, due Monday
(Mathematics, Translation, & Rotation)
This may be tough—start early!