W3C home > Mailing lists > Public > public-css-archive@w3.org > October 2020

Re: [csswg-drafts] [css-color-4] Predefined CMYK colorspace (#3449)

From: Chris Lilley via GitHub <sysbot+gh@w3.org>
Date: Fri, 16 Oct 2020 16:06:43 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-710148144-1602864402-sysbot+gh@w3.org>
Hi @karip thanks for the pointers to CMYK conversions used by browser js-based PDF viewers. These seemed interesting so I took a deeper look. To date I just examined the PDFium approach.

I copied the PDFium code you linked to, made a few search and replace to use standard types (`float`, uint8_t`) and added a table of CMYK FOGRA39 values for the 24 swatches in a Macbeth color checker and wrote a main function to iterate over these, converting to sRGB. [Modified code here](https://drafts.csswg.org/css-color-4/workings/CMYK_to_sRGB.cc) and [Macbeth color values in assorted colorspaces here](https://drafts.csswg.org/css-color-4/workings/MacBeth-Lab.txt). I then calculated the deltaE 2000 between the original Lab values and the sRGB values.

The result can be [seen here](https://drafts.csswg.org/css-color-4/PDFium.html), with an SVG of the converted colors and a table of deltaE 2000 values. For comparison, a similar analysis of [roundtripping Lab -> CMYK -> Lab](https://drafts.csswg.org/css-color-4/#cal-cmyk), again with deltaE 2000, and [naive conversion from CMYK to sRGB](https://drafts.csswg.org/css-color-4/#device-cmyk) which gives frankly comical results.

It seems that the PDFium conversion is significantly worse than the ICC approach (but as the ICC gives deltaE of like 0.04, it can be 25 times worse without actually being visible) and significantly better than the naive approach. 

There are problems in the dark areas especially, which would crush shadow detail. I suspect this is because they are working on gamma-corrected sRGB values in the lookup table; if that table was populated by linear-light values, and the final linear-light sRGB value gamma corrected, I suspect this effect would be much reduced.

I will try to have a look at the pdf.js approach too.

-- 
GitHub Notification of comment by svgeesus
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3449#issuecomment-710148144 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 16 October 2020 16:06:45 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:20 UTC