filter() \ Language (API) \ Processing 1.0
Author: Casey Reas & Ben Fry
Description: Processing is an electronic sketchbook for developing ideas. It is a context for learning fundamentals of computer programming within the context of the electronic arts.
Keywords: Processing, Processing, Interactive Media, Electronic Arts, Programming, Java, Ben Fry, Casey Reas

Reference for Processing version 1.5. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.

Name | ### filter()
Examples |
    PImage b;
    b = loadImage("topanga.jpg");
    image(b, 0, 0);
    filter(THRESHOLD);
    PImage b;
    b = loadImage("topanga.jpg");
    image(b, 0, 0);
    filter(GRAY);
    PImage b;
    b = loadImage("topanga.jpg");
    image(b, 0, 0);
    filter(INVERT);
    save("filter_invert.tif");
    PImage b;
    b = loadImage("topanga.jpg");
    image(b, 0, 0);
    filter(GRAY);
    filter(POSTERIZE, 4);
    PImage b;
    b = loadImage("topanga.jpg");
    image(b, 0, 0);
    filter(BLUR, 6);
Description | Filters the display window as defined by one of the following modes: THRESHOLD - converts the image to black and white pixels depending if they are above or below the threshold defined by the level parameter. The level must be between 0.0 (black) and 1.0(white). If no level is specified, 0.5 is used. GRAY - converts any colors in the image to grayscale equivalents INVERT - sets each pixel to its inverse value POSTERIZE - limits each channel of the image to the number of colors specified as the level parameter BLUR - executes a Guassian blur with the level parameter specifying the extent of the blurring. If no level parameter is used, the blur is equivalent to Guassian blur of radius 1. OPAQUE - sets the alpha channel to entirely opaque. ERODE - reduces the light areas with the amount defined by the level parameter. DILATE - increases the light areas with the amount defined by the level parameter.
Syntax |
    filter(MODE)
    filter(MODE, level)
Parameters |
MODE | Either THRESHOLD, GRAY, INVERT, POSTERIZE, BLUR, OPAQUE, ERODE, or DILATE
level | int or float: defines the quality of the filter
Returns | None
Usage | Web & Application
Related | blend()

Updated on August 30, 2010 04:29:39pm EDT