import java.awt.Color; //awt is Abstract Window Toolkit public class ColorSeparation { public static void main(String [] args) { //rad in the picture specified by command-line argument Picture pic = new Picture(args[0]); int width = pic.width(); int height = pic.height(); // create three empty pictures of same size Picture R = new Picture(width,height); Picture G = new Picture(width,height); Picture B = new Picture(width,height); for(int i = 0; i < width; i++){ for(int j = 0; j < height; j++) { Color c = pic.get(i,j); int r = c.getRed(); int g = c.getGreen(); int b = c.getBlue(); R.set(i,j, new Color(r,0,0)); G.set(i,j, new Color(0,g,0)); B.set(i,j, new Color(0,0,b)); } } R.show(); G.show(); B.show(); pic.show(); } }