Added generic Save function for images