FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Java
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
TABLE OF CONTENTS
October 19, 2007

Custom Image Processing in Java

(Page 4 of 4)

A Note about Filters Performance

Image filters perform a lot of operations on images, and performance can easily degrade if you do not pay attention to a few details. Whenever you write a filter assuming the source image will be of type INT_RGB or INT_ARGB, make sure the source image is actually of that type.

Usually, compatible images (images created with GraphicsConfiguration.createCompatibleImage()), which are designed to be in the same format as the screen, are stored as integers. It is often the case that the user's display is in 32- bit format and not the older 8-, 16-, and 24-bit formats. Therefore, it is a good idea to always load your images as compatible images.

The CustomImageOp demo loads a JPEG picture, which would normally be of type 3BYTE_BGR, and turns it into a compatible image of type INT_RGB. You can look for the call to GraphicsUtilities.loadCompatibleImage() in the source code of the demo and replace it with ImageIO.read() to see the difference when moving the sliders of the user interface. As a rule of thumb, do not hesitate to use the various methods from the GraphicsUtilities class to always use compatible images.

Summary

Java 2D offers several powerful facilities to perform image processing on your pictures. The built-in BufferedImageOp implementations let you write your own custom filters very quickly. And if you need more flexibility, you can even create a new BufferedImageOp implementation from scratch.

Previous Page | 1 Image Filters | 2 Processing an Image with BufferedImageOp | 3 Custom BufferedImageOp | 4 A Note about Filters Performance
RELATED ARTICLES
No Related Articles
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK