It is interesting to use various "mathematical" tricks to create effects which are part of "standard" image manipulation packages.
The attached PDF shows how to make a "sketch" out of a colour image. It also teaches a few image manipulation tricks along the way.
Ultimately, an image is "just" a array where
is the height,
is the width and
is the number of "primary colour planes" (usually 3 which is RGB). All kinds of matrix manipulation is possible!