Public bug reported:

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_AllocateT(FIT_RGBF, n, n);

        unsigned int nPitch = FreeImage_GetPitch(pBitmap);
        BYTE *pBits = reinterpret_cast<BYTE*>(FreeImage_GetBits(pBitmap));

        float *buf = reinterpret_cast<float*>(img);
        unsigned int i = 0;
        for (int y = 0; y < n; ++y)
        {
                float *pPixel = reinterpret_cast<float*>(pBits);
                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_Save(FIF_EXR, pBitmap, "test.exr", EXR_DEFAULT)) 
std::cout << "EXR error\n";
        if (!FreeImage_Save(FIF_HDR, pBitmap, "test.hdr")) std::cout << "HDR 
error\n";
        FreeImage_Unload(pBitmap);
        return 0;
}

** Affects: freeimage (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1614266

Title:
  Freeimage library does not write EXR files

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/freeimage/+bug/1614266/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to