>
> On Tue, Feb 21, 2017 at 1:15 PM, Marco Freudenberger <Marco.Freudenberger@
> entrustdatacard.com> wrote:
>
>> No. I’m actually talking about images that do not have an ICC profile
>> embedded. Well – maybe all, actually.
>>
>>
>>
>> Lines 187-191:
>>
>>
>>
>> if( !png_get_gAMA(png, info, &gamma))
>>
>>             gamma = 1.0;
>>
>>
>>
>> /* we're not displaying but converting, screen gamma == 1.0 */
>>
>> png_set_gamma(png, 1.0, gamma);
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> -          You try to read the file gamma. If none found, you set it to
>> 1.0. That I think is the first mistake…
>>
>> -          Then you set the screen gamma to 1.0. This is PROBABLY the
>> next mistake, as the typical screen gamma is ~ 2.2. Linear gamma is
>> unusual. The two “mistakes” might eliminate each other for images with NO
>> gAMA chunk (because no correction is done for the screen).
>>
>> -          I think png_set_gamma actually makes sure that the RGB (or
>> gray …) values you are getting from the file are adjusted by (file gamma) /
>> (screen gamma) – so you are not reading the values originally encoded in
>> the file... I might be wrong, I didn’t check the documentation.
>>
>> So …
>>
>> -          If the file has an embedded gamma of 2.2, you would modify
>> the values because the “screen gamma” is set to 1.0
>>
>>
> Thanks. I tried using 2.2 and it broke a lot of my unit tests.  I guess
> allowing the user to set the gamma would be best - can blame the user if
> something goes wrong :)
>
>>
>>
>
>
>> Another big problem is, that this seems to be applied EVEN THOUGH an ICC
>> profile might be embedded in the file, which already does any file color
>> space -> screen color space for you. So if you have a file gamma AND an ICC
>> profile, you might change values (especially “light intensity” of colors)
>> while actually the ICC profile does all of that.
>>
>> IF you want to use the file gamma to correct images when displaying them
>> (or converting to another ICC profile), you should rather generate an “on
>> the fly” icc profile based on the file gamma (and given (cHRM chunk) or
>> assumed chromatic primaries rather than having libpng modifying the values
>> you read for you. This is often an area of confusion with libpng ... I hope
>> I expressed that all in a way that it can be understood… I’m not a English
>> is not my mothers tongue and I tend to make technical descriptions
>> extremely complicated …
>>
>
> Thanks, your writing is crystal clear - just a lot of detail to think
> over. I have changed my code so that gamma is only applied if there is no
> ICC.
>
> Best,
> Aaron
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to