Make Blue Image Green

Solve It

In this example we want to turn the Duke Blue pixels of the Duke logo a greenish color (red value 0, blue value 100, green value 255). Since only the white pixels have a red value of 255, we can use that condition in our if statement to identify the pixels we want to change.

Code It

// green blue devil var image = new SimpleImage("duke_blue_devil.png"); for (var pixel of image.values()) { if (pixel.getRed() < 200) { pixel.setRed(0); pixel.setGreen(255); pixel.setBlue(100); } } print(image);

See It


Available Images


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.