Split out image and cairo routines