Freeimage library does not write EXR files
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
freeimage (Ubuntu) |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
Writing an EXR file through Freeimage (3.17.0+ds1-2) on Xubuntu 16.04 results in a file with zero bytes, while a corresponding HDR file is written correctly. On 14.04 both images are written correctly. Here is a minimal example writing both formats and reproducing the problem:
// compile with g++ -lfreeimage test.cpp
#include <FreeImage.h>
#include <iostream>
struct Rgb
{
float r, g, b;
Rgb() {}
Rgb(float x, float y, float z): r(x), g(y), b(z) {}
};
int main()
{
const int n = 512;
Rgb img[n * n];
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
img[i*n + j] = Rgb((float) i / n, (float) j / n, 0.0f);
FIBITMAP* pBitmap;
pBitmap = FreeImage_
unsigned int nPitch = FreeImage_
BYTE *pBits = reinterpret_
float *buf = reinterpret_
unsigned int i = 0;
for (int y = 0; y < n; ++y)
{
float *pPixel = reinterpret_
for (int x = 0; x < n; ++x)
{
pPixel[0] = buf[i++];
pPixel[1] = buf[i++];
pPixel[2] = buf[i++];
pPixel += 3;
}
pBits += nPitch;
}
if (!FreeImage_
if (!FreeImage_
FreeImage_
return 0;
}
Hi Milos,
Could you try building FreeImage 3.17.0 from source, run your example on it and report whether the same problem occurs.
The major difference between the packaged FreeImage and the source one is that the latter embeds its own dependencies whereas the former is (quite heavily) patched to use the system libraries. Consequently, we need to identify first whether the issue comes from the upstream code or the packaged version.
Cheers,
Ghis