Loading and Manipulating Images

-Dr. John Ostuni

Another major section of this book is composed of Chapters 4, 5 and 6. These sections cover loading and manipulating image data. Although Java has always included methods to decode GIF and JPEG images, the ability to read other formats was not available. Also the ability to write formatted images was not available at all. These limitations were removed with the introduction of the Image I/O API in jdk1.4. The Image I/O API provides a pluggable architecture for working with images stored in files and accessed across the network. This API is based on format-specific plug-ins, some of which are contained as part of the Java standard edition whereas others can be downloaded from third parties or written as needed.

Besides loading image data, another difficulty in Java was the limitations in working with image data. Although there were classes to perform image processing, it was difficult to put together a professional image processing application. These limitations were removed with the release of the Java Advanced Imaging API. This API provides the foundation necessary for complex image manipulation, processing, and analysis. The Java Advanced Imaging (JAI) API can be thought of as an extension of Java 2D. It was designed so that a user can develop sophisticated and complete image processing applets and applications. It contains more than 80 image processing operations. It is also extensible so that users can add their own operations. It provides support for many different data types and image formats. One more interesting aspect of the JAI API is that for many platforms, native code is included in order to take advantage of any platform specific libraries that might improve image processing speed. At runtime, if the Java interpreter finds the native classes, they will be used. If they are not found, the interpreter will fall back to a pure Java mode.

Image I/O and Image Manipulation Coverage in This Book

The three chapters in this section of the book progress in a logical manner. Chapter 4 covers the standard image I/O and image manipulation prior to the release of jdk1.4 and the Java Advanced Imaging API. Chapter 5 covers the Image I/O API, whereas Chapter 6 covers the Java Advanced Image API.

The structure of the three chapters is as follows:

  • Chapter 4, “Immediate Mode Imaging Model”— In this chapter, I will discuss the image 2D Graphics and Imaging on the Java Platform I/O and image processing available in the Java 2D API. This chapter covers the basic concepts of an image: how to load and manipulate images.

  • Chapter 5, “Image I/O API”— In this chapter, I will not only examine how the Java Image I/O API is used, but also I will devote a significant portion of this chapter to developing new Image I/O plug-ins. All the major features, concepts, and classes are discussed.

  • Chapter 6, “Java Advanced Imaging”— In this chapter, I will concentrate on the main JAI classes, specifically why they were developed and how they interact. I will examine all the image processing operations and how they are used. Finally, I will discuss some advanced topics such as a rendered versus renderable layer, remote image processing, and extending the JAI to add your own image processing operations.

Obtaining and Installing the Image I/O API and the Java Advanced Imaging API

Starting with jdk1.4, the Java I/O API is part of the Java standard edition. Thus, there is no need to download it separately.

On the other hand, the Java Advanced Imaging API is not part of the Java standard edition and must be downloaded separately. This can be done at the following URL: http://java.sun.com/products/java-media/jai/downloads/download.html. Because there is native code in this API, you will have to choose among a Solaris, Linux, or Windows download. Besides being able to download the JAI API, you can also download demos and a tutorial at this URL.

Additional Resources for the Image I/O and the Java Advanced Imaging APIs

To augment the information found in Chapter 4, refer to the Java 2D home page at http://java.sun.com/products/java-media/2D/index.html.

To augment the information found in Chapter 5, refer to the Image I/O home page at http://java.sun.com/j2se/1.4/docs/guide/imageio/index.html. This URL contains a description of each of the packages composing the Image I/O API. It also contains a link to a Java Image I/O API Guide.

To augment the information found in Chapter 6, refer to the JAI home page at http://java.sun.com/products/java-media/jai/index.html. Another useful URL is the JAI API page at http://java.sun.com/j2se/1.4/docs/api/index.html. This page provides all the methods for all the JAI classes, so it makes a great resource when you start programming. You can download a local copy of this API from the JAI Documentation page at http://java.sun.com/products/java-media/jai/docs/index.html. This page also contains a JAI programming guide so that you can see examples of Java programs using JAI.

If you still have questions regarding some aspect of the JAI, you can go to the JAI FAQ page at http://java.sun.com/products/java-media/jai/forDevelopers/jaifaq.html. Another useful resource is the JAI Interest Group, which provides answers and comments to the questions other members of the group pose. To view an archive of this e-mail, refer to http://archives.java.sun.com/archives/jai-interest.html. Finally, if you find some part of the JAI that isn't working as it should, you can refer to the JAI bug pages to either submit a bug report or to see whether it has already been submitted. This page can be found at http://java.sun.com/products/java-media/jai/jai-bugs.html.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset