Remove the imaging dependency of r