FAQ
 
 
Cover  \ Exhibition  \ Learning  \ Reference  \ Download  \ Discourse   
      Language \ Environment \ Libraries \ Comparison
 
   
   
Abridged (A-Z) \ Complete (A-Z)  
   
  Reference for Processing (BETA) version 91+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.  
Name  

PImage

   
Examples  
PImage b; 
b = loadImage("laDefense.jpg"); 
image(b, 0, 0); 
Description   Datatype for storing images. Processing allows display of .gif and .jpg images. Images may be displayed in 2D and 3D space. Before an image is used, it must be loaded with the loadImage() function. The PImage object contains properties for the width and height of the image, as well as an array called pixels[] which contains the values for every pixel in the image. A group of methods, described below, allow easy access to the image's pixels / alpha channel and simplify the process of compositing.
   
Fields  
width
  image width

height
  image height

pixels[]
  array containing the color of every pixel in the image

   
Methods  
get()
  Reads the color of any pixel or grabs a rectangle of pixels

set()
  Writes a color to any pixel or writes an image into another

copy()
  Copies the entire image

mask()
  Masks part of the image from displaying

blend()
  Copies a pixel or rectangle of pixels using different blending modes

filter()
  Converts the image to grayscale or black and white

   
   
Constructors  
PImage()
PImage(width, height)
PImage(pixels[], width, height, format)
PImage(img)
   
Parameters  
width   int: image width

height   int: image height

pixels[]   int[] or color[]: array of integers or colors, must be the same dimension as width*height

format   Either RGB, RGBA, ALPHA (grayscale alpha channel)

img   java.awt.Image: assumes a MediaTracker has been used to fully download the data and the img is valid

   
Usage   Web & Application
   
Related   loadImage()
imageMode()
 
 






   
 
Updated: Fri Jul 15 16:35:56 PDT 2005
 
 








Creative Commons License
 
  Processing is an open project initiated by Ben Fry and Casey Reas  
  © Info