The FIICCPROFILE returned from FreeImage_GetICCProfile for tiff images is often invalid due to it being overwritten. This doesn't seem to affect 3.17.0, only cvs. Attached is a simple patch to fix this.
Do you mean that LibTIFF modify the ICC color profile while loading an image ?
I don't understand your use-case when looking at your main.cpp file.
Hervé
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2018-07-30
No, I mean that the pointer returned by FreeImage_GetICCProfile for tiffs points to uninitialized/freed/garbage memory. The main.cpp file just shows that by checking for the magic number (it isn't my actual code). I couldn't see where this happens in the source though, so the memcpy is just a basic fix. As a work around I'm now using LibTIFF 4.0.9 directly with TIFFGetField(... TIFFTAG_ICCPROFILE, ...) which works correctly.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here's some code to reproduce this.
Hi,
Do you mean that LibTIFF modify the ICC color profile while loading an image ?
I don't understand your use-case when looking at your main.cpp file.
Hervé
No, I mean that the pointer returned by FreeImage_GetICCProfile for tiffs points to uninitialized/freed/garbage memory. The main.cpp file just shows that by checking for the magic number (it isn't my actual code). I couldn't see where this happens in the source though, so the memcpy is just a basic fix. As a work around I'm now using LibTIFF 4.0.9 directly with TIFFGetField(... TIFFTAG_ICCPROFILE, ...) which works correctly.
OK,
so since FreeImage now use LibTiff 4.0.9, I suppose we can close this bug for the next release ?
(see https://sourceforge.net/p/freeimage/svn/HEAD/tree/FreeImage/trunk/ )
Hervé
Yes, you are right, it does seem to be fixed now so it must have been a bug in LibTiff. Thanks for your help.
fixed in release 3.18.0