Improve how temporary images are handled.