Significantly cleaned up `imageToDevILRepr`. Also made the types more concrete.