Cancelling a 32 bits Tiff workaround, now the Gamma value from embedded
ICC profile is correctly handled
This commit is contained in:
parent
a989d440b1
commit
81c5b1ca41
@ -771,8 +771,9 @@ int ImageIO::loadTIFF (Glib::ustring fname)
|
|||||||
* We could use the min/max values set in TIFFTAG_SMINSAMPLEVALUE and
|
* We could use the min/max values set in TIFFTAG_SMINSAMPLEVALUE and
|
||||||
* TIFFTAG_SMAXSAMPLEVALUE, but for now, we normalize the image to the
|
* TIFFTAG_SMAXSAMPLEVALUE, but for now, we normalize the image to the
|
||||||
* effective minimum and maximum values
|
* effective minimum and maximum values
|
||||||
*
|
*/
|
||||||
printf("Informations de \"%s\":\n", fname.c_str());
|
if (options.rtSettings.verbose) {
|
||||||
|
printf("Informations of \"%s\":\n", fname.c_str());
|
||||||
uint16 tiffDefaultScale, tiffBaselineExposure, tiffLinearResponseLimit;
|
uint16 tiffDefaultScale, tiffBaselineExposure, tiffLinearResponseLimit;
|
||||||
if (TIFFGetField(in, TIFFTAG_DEFAULTSCALE, &tiffDefaultScale)) {
|
if (TIFFGetField(in, TIFFTAG_DEFAULTSCALE, &tiffDefaultScale)) {
|
||||||
printf(" DefaultScale: %d\n", tiffDefaultScale);
|
printf(" DefaultScale: %d\n", tiffDefaultScale);
|
||||||
@ -801,9 +802,8 @@ int ImageIO::loadTIFF (Glib::ustring fname)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf(" No maximum value!\n\n");
|
printf(" No maximum value!\n\n");
|
||||||
printf("\n");
|
printf(" Those values are not taken into account, the image data are normalized to a [0;1] range\n\n");
|
||||||
*/
|
}
|
||||||
|
|
||||||
|
|
||||||
char* profdata;
|
char* profdata;
|
||||||
deleteLoadedProfileData();
|
deleteLoadedProfileData();
|
||||||
@ -811,30 +811,8 @@ int ImageIO::loadTIFF (Glib::ustring fname)
|
|||||||
|
|
||||||
if (TIFFGetField(in, TIFFTAG_ICCPROFILE, &loadedProfileLength, &profdata)) {
|
if (TIFFGetField(in, TIFFTAG_ICCPROFILE, &loadedProfileLength, &profdata)) {
|
||||||
embProfile = cmsOpenProfileFromMem (profdata, loadedProfileLength);
|
embProfile = cmsOpenProfileFromMem (profdata, loadedProfileLength);
|
||||||
|
|
||||||
// For 32 bits floating point images, gamma is forced to linear in embedded ICC profiles
|
|
||||||
if ( sampleFormat & (IIOSF_LOGLUV24 | IIOSF_LOGLUV32 | IIOSF_FLOAT) ) {
|
|
||||||
// Modifying the gammaTRG tags
|
|
||||||
cmsWriteTag(embProfile, cmsSigGreenTRCTag, (void*)Color::linearGammaTRC );
|
|
||||||
cmsWriteTag(embProfile, cmsSigRedTRCTag, (void*)Color::linearGammaTRC );
|
|
||||||
cmsWriteTag(embProfile, cmsSigBlueTRCTag, (void*)Color::linearGammaTRC );
|
|
||||||
|
|
||||||
// Saving the profile in the memory
|
|
||||||
cmsUInt32Number bytesNeeded = 0;
|
|
||||||
cmsSaveProfileToMem(embProfile, 0, &bytesNeeded);
|
|
||||||
|
|
||||||
if (bytesNeeded > 0) {
|
|
||||||
loadedProfileData = new char[bytesNeeded + 1];
|
|
||||||
cmsSaveProfileToMem(embProfile, loadedProfileData, &bytesNeeded);
|
|
||||||
}
|
|
||||||
|
|
||||||
loadedProfileLength = (int)bytesNeeded;
|
|
||||||
} else {
|
|
||||||
// Saving the profile in the memory as is
|
|
||||||
loadedProfileData = new char [loadedProfileLength];
|
loadedProfileData = new char [loadedProfileLength];
|
||||||
memcpy (loadedProfileData, profdata, loadedProfileLength);
|
memcpy (loadedProfileData, profdata, loadedProfileLength);
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
embProfile = NULL;
|
embProfile = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user