The map-image
command runs a function on every pixel of an image. See the map-image documentation for the official info.
blue-only
: Keep only the blue, removing red and green.black-white
: Turn an image to black and white. You will need to decide how to set the threshold.grayscale
: Turn an image to grayscale.green-to-white
: Change only green pixels to white.There are several logical ways of combining the red, green, and blue components to get one number. The most common is averaging, but it is not the only way.
Make the function color-distance: color->color
, which measures the distance between two colors in the same way that distance
measures the distance between two posns.
The formula for color distance would be:
(square root of (r1-r2)^2 + (g1-g2)^2 + (b1-b2)^2)
Your color-distance
function can be used to change colors near green to white, so you don’t have to have perfect green to see it work.