int ret = stbi_write_png(filename, width, height, 4, static_cast<const void*>(dst.data()), width * 4);
return (ret > 0);
}
int main(int argc, char** argv)
{
if (argc < 3) {
printf("Usage: exr2ldr input.exr output.png (scale) (resize_factor) (gammavalue) (-i or --ignore-alpha).\n");
printf(" Pixel value [0.0, 1.0] in EXR is mapped to [0, 255] for LDR image.\n");
printf(" You can adjust pixel value by `scale`(default = 1.0).\n");
printf(" Resize image using `resize_factor`(default = 1.0). 2 = create half size image, 4 = 1/4 image, and so on\n");
printf(" gammmavalue will be used for gamma correction when saving png image(default = 2.2).\n");
printf(" Ignore alpha value of input using -i or --ignore-alpha flag, and alpha of output is set to 255.\n");
exit(-1);
}