Introduction

To begin, let's look at a simple program written using the Java Advanced Imaging (JAI) package. This program (shown in Listing 6.1) takes as parameters an image filename and a scale factor. It loads the image, scales its dimensions, and displays the results.

Listing 6.1 Intro.java
 package ch6; import java.awt.*; import javax.swing.*; import java.awt.image.renderable.ParameterBlock; import javax.media.jai.JAI; import javax.media.jai.RenderedOp; /** Intro.java -- objects of this class perform the following steps: 1. reads an image file 2. scales the image dimensions using provided scale factor 3. displays the result */ public class Intro extends JFrame { public Intro(String filename, String scaleFactor) { ParameterBlock pb; /* create ...

Get Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.