Introduction
Involution is a common transformation in mathematical contests. However, it can be difficult to visualize. Unlike the transformations typically taught in high school, an involution can produce an image that looks completely different from the original—without any apparent similarity.
To some extent, you can imagine involution as follows: First, place a ball at the center of the transformation. Then, project the original image onto the north pole of the ball. Next, position a new plane parallel to the original image at the north pole and project the image back through the south pole of the ball.
In the following program, I use the spng library to decode a PNG image, scale it up, apply the involution transformation, and then encode it back into a PNG file.