Move functions to imageprocessing, and convert a warning to an exception.