On Tue, Feb 21, 2017 at 4:07 PM, Marco Freudenberger <
marco.freudenber...@entrustdatacard.com> wrote:
> PS: A lot of the reaction of course also depend on how you handle the
> image data once loaded – and obviously what your expected unit test results
> are.
>
>
>
> I’ve tried to implement a full “image handling” library a while ago (a
> layer up from libpng, tiff, …) , when I found that most higher level open
> source library don’t do a very good job with color management in my
> opinion, at least not the ones I’ve tested. Unfortunately I didn’t have the
> time yet to finish it or get it to a point where it is really useful for
> others, especially the “build system” is more than clunky (I wanted to
> create cmake environment, so that it is easy to use it cross platform … )
> and the unit tests are more manual test entry points than real unit tests
> at this time. Again haven’t got a lot of time to work on that as it’s a
> private project and I’m currently loaded with job-work, but if I remember
> correctly, the PNG READ handling should be OK to some extent. If I also
> remember correctly, the code to write PNG files is not checked in as I
> haven’t validated it’s correctness for all color formats and bit depths.
>
>
>
> The library Itself doesn’t do a lot “upstream” with the image files,
> although I think the (more manual …) test code had some color space
> conversion examples, especially like “convert everything to sRGB” if I
> remember correctly.
>
>
>
> https://github.com/freudi74/mfimage
>
Cool project! Thanks for sharing this.
>
> *Von:* Marco Freudenberger
> *Gesendet:* Dienstag, 21. Februar 2017 14:51
> *An:* 'Aaron Boxer'
> *Cc:* Noel Carboni; lcms-user@lists.sourceforge.net
> *Betreff:* AW: [Lcms-user] Apply profile with PCS = cmsSigXYZData, Color
> Space = cmsSigGrayData
>
>
>
> Well, if you set BOTH gammas to 2.2, it should work.
>
>
>
> What test cases do you have and what are the expected results?
>
>
>
> *Von:* Aaron Boxer [mailto:boxe...@gmail.com]
> *Gesendet:* Dienstag, 21. Februar 2017 12:58
> *An:* Marco Freudenberger
> *Cc:* Noel Carboni; lcms-user@lists.sourceforge.net
> *Betreff:* Re: [Lcms-user] Apply profile with PCS = cmsSigXYZData, Color
> Space = cmsSigGrayData
>
>
>
>
>
>
>
> 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