28 if (!(
tile.size ==
tile.full_size)) {
35 if (image_output ==
nullptr) {
36 log_(
"Failed to create image file");
40 const int width =
tile.size.x;
41 const int height =
tile.size.y;
43 const ImageSpec spec(width, height, 4, TypeDesc::FLOAT);
44 if (!image_output->open(
filepath_, spec)) {
45 log_(
"Failed to create image file");
50 if (!
tile.get_pass_pixels(
pass_, 4, pixels.data())) {
51 log_(
"Failed to read render pass pixels");
56 OIIO::ImageBuf image_buffer(spec,
57 pixels.data() + (height - 1) * width * 4,
59 -width * 4 *
sizeof(
float),
67 const float g = 1.0f / 2.2f;
68 OIIO::ImageBufAlgo::pow(image_buffer, image_buffer, {g, g, g, 1.0f});
72 image_buffer.set_write_format(TypeDesc::FLOAT);
73 image_buffer.write(image_output.get());
74 image_output->close();