Education/Projects/ProcessingForTheWeb/PImage.get

From MozillaWiki
< Education‎ | Projects‎ | ProcessingForTheWeb
Revision as of 06:05, 22 November 2009 by Anna.sobiepanek (talk | contribs) (Created page with '== Summary == This is a method of the PImage class written for Education/Projects/ProcessingForTheWeb. Gets the color of a pixel, a group of pixels, or the entire image. [h…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Summary

This is a method of the PImage class written for Education/Projects/ProcessingForTheWeb. Gets the color of a pixel, a group of pixels, or the entire image. View official Reference

Examples

PImage img = loadImage("tower.jpg");
background(img);
PImage b = img.get(50, 0, 50, 100);

image(b, 0, 0);

Syntax

img.get(): returns the entire image
img.get(x, y): returns the color of a single pixel in the img pixels[y*width+x]
img.get(x, y, width, height): returns a section of the display window by specifing an additional width and height parameter. If the pixel requested is outside of the image window, black is returned.

Parameters

img: PImage x: x-coordinate of the pixel
y: y-coordinate of the pixel
width: width of pixel rectangle to get
height: height of pixel rectangle to get

Returns

color or PImage

Bugs

Refer to the reference of each function for a specific bug report.

Bug Description Fixed?(Date)

Tests