2. Consider writing code that starts with the image "chapel.png" shown below on the left and removes all the red from the image, resulting in the picture on the right below. The code has been started below but has missing code. var image = new Simplelmage("chapel.png"); // missing code print(image); Which one of the following is the best choice for the correct missing code to remove all the red from the image? for (var pixel of image.values()) { var red = pixel.getRed(); pixel.setRed(red - 200); O for (var pixel of image.values() { var red = pixel.getRed(); pixel.setRed(red - 100); for (var pixel of image.values()) { pixel.setRed(0); } for (var pixel of image.values()) { var red = nixel getRed0:

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter16: Graphics
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question

HELP

0/1 poir
2. Consider writing code that starts with the image "chapel.png" shown below on the left and removes all the red from the
image, resulting in the picture on the right below.
The code has been started below but has missing code.
var image = new Simplelmage("chapel.png");
// missing code
print(image);
Which one of the following is the best choice for the correct missing code to remove all the red from the image?
for (var pixel of image.values()) {
var red = pixel.getRed()3B
pixel.setRed(red - 200);
}
O for (var pixel of image.values()) {
var red = pixel.getRed();
pixel.setRed(red - 100);
O for (var pixel of image.values()) {
pixel.setRed(0);
for (var pixel of image.values()) {
var red = pixel.getRed();
pixel.setRed(red - 1000);
}
I Incorrect
This is not a correct answer. This removes some of the red but not all of the red. It may also try to set pixels to
negative numbers.
Transcribed Image Text:0/1 poir 2. Consider writing code that starts with the image "chapel.png" shown below on the left and removes all the red from the image, resulting in the picture on the right below. The code has been started below but has missing code. var image = new Simplelmage("chapel.png"); // missing code print(image); Which one of the following is the best choice for the correct missing code to remove all the red from the image? for (var pixel of image.values()) { var red = pixel.getRed()3B pixel.setRed(red - 200); } O for (var pixel of image.values()) { var red = pixel.getRed(); pixel.setRed(red - 100); O for (var pixel of image.values()) { pixel.setRed(0); for (var pixel of image.values()) { var red = pixel.getRed(); pixel.setRed(red - 1000); } I Incorrect This is not a correct answer. This removes some of the red but not all of the red. It may also try to set pixels to negative numbers.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Hyperlinks
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage