Writes the image to a file.
The file format is chosen based on the file ending, but currently only OpenEXR (.exr) high-dynamic range images are supported.