I wanted to sort the colors from this image by perceived brightness
This is the only step where the script is used. We take the original image and, for each pixel, map the color to its perceive brightness. Then we display the value on the red component.