I'm in situation that I have a float64 image stored in a binary format. I would like to read the content of the file and store it in int64, so that I can tonemap it.
The question how would I convert float images into int64 in C++. Here is my approach of reading the file The file is here https://www.mediafire.com/file/ffv6qzvpg05xaja/15_init_image.bin/file
#include <iostream>
#include <stdlib.h>
#include <fstream>
#include <vector>
#include "FreeImage.h"
int main()
{
std::ifstream stream("c:/output/15_init_image.bin", std::ios::in | std::ios::binary);
std::vector<uint8_t> contents((std::istreambuf_iterator<char>(stream)), std::istreambuf_iterator<char>());
int width = 2048; // get the width of the image ;
int height = 3096; // get the height of the image ;
int bpp = 32;
FreeImage_Initialise();
int pitch = 512;
FIBITMAP* src = FreeImage_ConvertFromRawBitsEx(true, contents.data(), FIT_BITMAP, width, height, pitch, FI_RGBA_RED_MASK,
FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK, FALSE);
FreeImage_Save(FIF_JPEG, src, "viewport.jpeg");
return 0;
}