Added image saving functionality.