FreeImage_GetFileType return FIF_PGM for png files (SOLVED)

Hi there,

I’ve been using OF and FreeImage for long time ago and never saw something like this. :frowning:

I get an iMx6 board and installed openframeworks to run in the framebuffer. Everything is working properly except loading png images that ends in a “terminate called after throwing an instance of ‘char const*’” error message.

I sent the result of FreeImage_GetFileType to the output and all PNGs are detected as FIF_PGM.
If I set the first parameter to FIF_PNG it will return 0, which means that the file was not loaded.

I read about PGM format and how can the PNG file being confused with PGM, no sense at all…

I’m cross compiling and I checked multiple times the libraries versions that is being linked, headers, etc… of freeimage and libpng. What can be wrong?!! I’m totally out of ideas…

Thank you in advance.

This actually sounds familiar … but I can’t remember what the solution was – @danoli3 Were you the one that solved something like this on OSX? If I recall, there is some conflict with the updated FreeImage + an internal version of libpng that is included in Poco … and I think we fixed it by disabling PDF support when we compiled Poco (or something) … sorry for this vague response …

Hi Christopher,

No please, I thank you for the inputs.
At least I know that is something related with libraries versions issue.

Anyway it’s quite strange cause I use the same png and poco versions on odroid and I had no such problem.

Maybe @danoli3 have also some inputs :slight_smile:

Thank you once again.

I’m cross compiling Poco and I cannot find any libpng dependency
Are you sure that was Poco library that you had to recompile?


In fact cairo does have pdf flag and it has libpng dependency.

Wasn’t cairo issue rather poco one? Trying to refreshing your memmory… :smile:

I downloaded the last FreeImage image, compiled as static and it’s working now.
Nothing related with other libraries, it was simply a problem with the FreeImage library provided on OF package with Freescale board and the rootfs system I’m using maybe…