Set All Pixels to White

Solve It

In this example, we set all the pixels in an image to the color white. This means that every pixel needs its red, green, and blue values all set to 255.

Code It

// set all to white var image = new SimpleImage("duke_blue_devil.png"); for (var pixel of image.values()) { pixel.setRed(255); pixel.setBlue(255); pixel.setGreen(255); } print(image);

See It

 
 

Available Images


duke_blue_devil.png
[397x337]

Drop your images onto the area above to make it available within your code editor on this page. Note: your images will not be uploaded anywhere, they will stay on your computer.