#define USE_PROXY // works without proxy ... #include #include #include #include #include #include int main(int argc, char* argv[]) { const int res_x = 1; const int res_y = 1; const int channels = 3; std::vector output_data(res_x * res_y * channels, 0); assert(argc == 1+1); const char* filename = argv[1]; OIIO::ROI roi(0, res_x, 0, res_y, 0, 1, 0, channels); OIIO::TypeDesc desc = OIIO::TypeDesc::UINT8; OIIO::ImageSpec image_spec(roi, desc); image_spec["oiio:ColorSpace"] = "sRGB"; // .. or without this line #ifdef USE_PROXY OIIO::Filesystem::IOFile proxy(filename, OIIO::Filesystem::IOProxy::Write); std::unique_ptr output = OIIO::ImageOutput::create("dummy.tif", &proxy); bool success = output->open("dummy2.tif", image_spec); assert(success); #else std::unique_ptr output = OIIO::ImageOutput::create(filename); bool success = output->open(filename, image_spec); assert(success); #endif success = output->write_scanlines( 0, res_y, 0, desc, output_data.data(), OIIO::AutoStride, OIIO::AutoStride); assert(success); output->close(); return 0; }