🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
612 B

#include <cstdio>
#include <cstdlib>
#include <vector>
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
#include "tinyexr.h"
int main(int argc, char** argv)
{
if (argc < 3) {
printf("Usage: exr2rgbe input.exr output.hdr\n");
exit(-1);
}
int width, height;
float* rgba;
const char* err;
{
int ret = LoadEXR(&rgba, &width, &height, argv[1], &err);
if (ret != 0) {
printf("err: %s\n", err);
return -1;
}
}
{
int ret = stbi_write_hdr(argv[2], width, height, 4, rgba);
if (ret == 0) {
return -1; // fail
}
}
return 0;
}