/** * PhotoLab.java * * @author Jeff Ondich, Dave Musicant * @version 11/5/05 * * A small test of the EzImage class. */ import java.io.*; import java.awt.*; public class PhotoLab { public static void main( String[] args ) throws IOException { // Instantiate the EzImage object and show the original photo. EzImage moosePicture = new EzImage( "moose.jpg" ); moosePicture.show( "Original", 100, 100 ); // Remove all the green and blue from the photo. int height = moosePicture.getHeight(); int width = moosePicture.getWidth(); int[][][] moosePixels = moosePicture.getPixels3D(); for( int row=0; row < height; row++ ) { for( int column=0; column < width; column++ ) { moosePixels[row][column][EzImage.greenIndex] = 0; moosePixels[row][column][EzImage.blueIndex] = 0; } } moosePicture.setPixels( moosePixels ); // Show the resulting red-only photograph in a second window. moosePicture.show( "Only red", 100, 350 ); } }