Encapsulate the image_origin stuff in a single function
(#380)