MCPcopy Create free account
hub / github.com/RenderKit/embree / storeEXR

Function storeEXR

tutorials/common/image/exr.cpp:51–69  ·  view source on GitHub ↗

! store PFM file to disk */

Source from the content-addressed store, hash-verified

49
50 /*! store PFM file to disk */
51 void storeEXR(const Ref<Image>& img, const FileName& fileName)
52 {
53 std::vector<Col3f> rgb(img->width * img->height);
54 for (size_t y=0; y<img->height; ++y) {
55 for (size_t x=0; x<img->width; ++x) {
56 Color4 c = img->get(x, y);
57 rgb[y * img->width + x] = Col3f(c.r, c.g, c.b);
58 }
59 }
60 const char* err = NULL;
61 int ret = SaveEXR((float*)rgb.data(), img->width, img->height, 3, 0, fileName.str().c_str(), &err);
62 if (ret != TINYEXR_SUCCESS) {
63 if (err) {
64 std::cerr << "ERR: " << err;
65 FreeEXRErrorMessage(err);
66 }
67 THROW_RUNTIME_ERROR("Could not save image " + fileName.str())
68 }
69 }
70}

Callers 1

storeImageFunction · 0.85

Calls 6

SaveEXRFunction · 0.85
FreeEXRErrorMessageFunction · 0.85
getMethod · 0.45
dataMethod · 0.45
c_strMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected