Java 2D and JAI Sample Code
Note:
1. If you have questions or comments, email me at larryhr2004@yahoo.com.
2. Visit my Image
Visualization Page to download graphics and imaging related applications and applets.
3. Visit my VisTech Software Web site, if you need consulting services in Java, Graphics, and Imaging.
4. Some of the examples in this page are simpler versions of the examples
in my book Building
Imaging Applications with Java Technology: Using AWT Imaging, Java 2D,
and JAI.
Printing
1. SimplePrint.java
This example shows how to load and print an image
without the need for a GUI component.
2. JAIImagePrint.java
Loads an image using the JAI codec and prints it
silently.
Image Manipulation
1. Zoom
This directory has three Java files that make a
simple zoom application.
In this example, you can draw a rectangle over the
image to zoom the image under this rectangle.
2. RotateImage.java
Loads and rotates an image. The loaded image is displayed
at the center of the viewport.
Creating BufferedImages from an Array of Pixel Data
1. RGBImageFactory.java
This example does the following:
i. Loads an image using AWT imging
ii. Extracts data using the PixelGrabber class
iii. From the array of data extracted in (ii), creates a BufferedImage
object using the pixel interleaved sample model.
iv. Displays the BufferedImage created in (iii) on a small panel.
2. BandedRGBImageFactory.java
Same as (1) except that this example uses the banded
sample model
Reading Image Data
1. Image
Data Viewer
This directory contains three Java files ImageDataViewer.java,
JAIImageDataViewer.java, ImageInfoUtil.java. To compile this code you ned
the plotterbeans.jar file, which you can download it from the books's site.
It is one of he four beans in the beans.zip file.
The ImageDataViewer app displays the image and the information about
image data. This is a cleaner version compared to the one in the book.
It loads only the JPEG image using the Java 2D's JPEG codec.
The JAIImageDataViewer app loads images using the JAI code. So,
it can display different types of images supported by JAI. Note that you
need JAI software to compile JAIImageDataViewer.java.
Edge Detection
1. EdgeDetector.java
This example shows how to apply the edge detector
operator available in JAI.
Multipage Tiff
1. MutiPageTiffRead.java
This example shows how to read a tiff image that
contains multiple pages.
2. Mutipagetiff.java
This example shows how to create a multipage tiff
image.
Splitting Single Image into Multiple Images
1. MultipleImageFactory.java
Cuts an image into multiple subimages and saves
them as JPEGs.
Those who don't own my book Building
Imaging Applications with Java Techology: Using AWT Imaging, Java 2D, and
Java Advanced Imaging (JAI) can download source code from the Addison-Wesley
site.
If you are interested in books, visit my Graphics
and Imaging Books and Java
Books pages.
Copyright (c) 2002-2004, Lawrence Rodrigues - All rights reserved.
Last modified July 9, 2004.