7.11.2. Filtering Images
In the preceding section, you saw how to build up an image from scratch. However, often you want to access image data for a different reason: You already have an image and you want to improve it in some way.
Of course, you can use the
getPixel/getDataElements methods that you saw in the preceding section to read the image data, manipulate them, and write them back. But fortunately, the Java 2D API already supplies a number of filters that carry out common image processing operations for you.
The image manipulations all implement the
BufferedImageOp interface. After you construct the operation, you simply call the
filter method to transform an image into another.
BufferedImageOp op = . . .; ...