// Jay Summet - GaTech // Released to the public domain, Sep 2009 public class ConditionalExample { public static void main( String [] args) { Picture p = new Picture( FileChooser.pickAFile()); Pixel [] myPixels = p.getPixels(); for( Pixel myP : myPixels) { int r = myP.getRed(); int g = myP.getGreen(); int b = myP.getBlue(); if ( (r+g+b > 500) && (myP.getY() < p.getHeight() / 2 ) ) { myP.setRed(0); myP.setGreen(255); myP.setBlue(0); } // end IF } // for every pixel. p.show(); System.out.println("all done!"); } // end main } // end class