Filtering Images

Java provides support for image filters, chunks of code which transform an image in a predictable fashion. For example, an image filter might remove the green and blue components of an image, leaving only the red. Or a filter might sharpen lines, or blur an image. The study of image transformations and filters is an active field, and I am not going to attempt to summarize it here. However, I will demonstrate how you can write some simple filters. More complicated filters are written similarly except that they use more complicated algorithms to filter the data.

In Java an image filter requires a subclass of java.awt.image.ImageFilter and a subclass of java.awt.FilteredImageSource. The FilteredImageSource implements the java.awt.ImageProducer interface. It starts with an existing Image, but passes it through the ImageFilter before sending the pixels to an ImageObserver or ImageConsumer.


Previous | Next | Top | Cafe au Lait

Copyright 1997, 2003 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified November 12, 2003