Consider writing code that turns the red part of every pixel in “chapel.png” to the highest red value possible. The image changes from the picture on the left to the redder picture on the right. The code has been started below but has missing code.
Consider writing code that turns the red part of every pixel in “chapel.png” to the highest red value possible. The image changes from the picture on the left to the redder picture on the right.
The code has been started below but has missing code.
var image = new SimpleImage("chapel.png");
// missing code
print(image);
Which one of the following is the best choice for the correct missing code to turn the chapel red?
for (var pixel of image.values()) { var number = pixel.getRed(); pixel.setRed(number + 20); }
for (var pixel of image.values()) { pixel.setRed(200); pixel.setBlue(0); pixel.setGreen(0); }
for (var pixel of image.values()) { pixel.setRed(100000); }
for (var pixel of image.values()) { pixel.setRed(255); }
Trending now
This is a popular solution!
Step by step
Solved in 2 steps