Image-5 Puzzles

< CS101

This is a short section to look at type of puzzle built out of image manipulation code.

Code To Fix the Pixels

Gold Puzzle

Here we have the "gold" puzzle image -- fix it to see the real image gold puzzle image

Gold puzzle parameters:


image-puzzle-gold

Solution code:

// Strategy: zero out blue and green as they
// are just garbage noise data.
// Then scale red up by 10x to see the real
// image in red.

  // your code here
  pixel.setGreen(0);
  pixel.setBlue(0);
  pixel.setRed(pixel.getRed() * 10);


Seeing Red

In this case, our solution shows the image, but it's all in red. What we have here is basically a black-and-white image, but it is shown in the black-red range, rather than the usual black-white. For this section, we'll say that's good enough. We'll see how to fix the red image so it looks like a proper black-and-white image in a later section.

> exercises