public static void FreeImageSaveExrBitmap(string fileName, int width, int height, RgbSpectrum[] data, string[] watermark = null) { using (var bmp = new FreeImageBitmap(width, height, FREE_IMAGE_TYPE.FIT_RGBF)) { for (int i = 0; i < bmp.Height; i++) { Scanline<FIRGBF> s = bmp.GetScanline<FIRGBF>(i); for (int j = 0; j < bmp.Width; j++) { try { var spectra = data[j + i * bmp.Width]; s[j] = new FIRGBF() { blue = spectra.c3, green = spectra.c2, red = spectra.c1 }; } catch (Exception ex) { Console.WriteLine(ex.Message); } } } if (watermark != null) { ApplyWaterMark(10, 400, bmp.ToBitmap(), watermark); } bmp.Save(fileName, FREE_IMAGE_FORMAT.FIF_EXR, FREE_IMAGE_SAVE_FLAGS.EXR_NONE); bmp.TmoReinhard05(1, 0.4); bmp.Save(fileName, FREE_IMAGE_FORMAT.FIF_PNG); } }