import java.awt.*; import java.awt.image.*; public class GreyScale { static ImageTool imTool = new ImageTool (); public static void main (String[] argv) { // Read in an image and display. Image image = imTool.readImageFile ("statue.jpg"); imTool.showImage (image, "original"); // Convert to grey scale and display. Image greyImage = toGreyScale (image); imTool.showImage (greyImage, "grey-scale"); } static Image toGreyScale (Image image) { // Extract pixels and size. int[][][] pixels = imTool.imageToPixels (image); int numRows = pixels.length; int numCols = pixels[0].length; // Make array of exactly the same size. int[][][] greyPixels = new int [numRows][numCols][4]; // INSERT YOUR CODE HERE Image greyImage = imTool.pixelsToImage (greyPixels); return greyImage; } }