add saving of image diagnostic