Useful image handling routines used by, but conceptually not dependant on, Perceptron.