Mojca Miklavec wrote: > On 2/4/07, Hans Hagen <[EMAIL PROTECTED]> wrote: > >> Peter Rolf wrote: >> >>> But to my surprise ConTeXt automatically converts my RGB colors (even >>> the MP defined ones), except that the final colors are in the CMY >>> instead of CMYK color space. All I want is a true RGBtoCMYK conversion. >>> I know about the calculating limitations in TeX, so I can wait for an >>> implemetation of that macro in LuaTeX. >>> >>> >> but even then ... we need a formula ... >> > > Most pages on the internet list the following simple conversion formula: > > C' = 1 - (R/range) C = (C' - K') / (1 - K') > M' = 1 - (G/range) M = (M' - K') / (1 - K') > Y' = 1 - (B/range) Y = (Y' - K') / (1 - K') > K' = MIN(C',Y',M') K = K' > > In the special case of K'=1, use (0,0,0,1) > > (I'm not a TeX guru, but I assume that conversion with current macros > should not be much more difficult than conversion with luaTeX.) > > this is what we have now
\def\doconvertRGBtoCMYK#1\to#2% {\colordimen#1\points \multiply\colordimen \plusthousand \colorcount\colordimen \advance\colorcount \medcard \divide\colorcount \maxcard \colorcount-\colorcount \advance\colorcount \plusthousand \edef#2{\realcolorvalue\colorcount}} \def\convertRGBtoCMYK#1#2#3% {\doconvertRGBtoCMYK#1\to\@@cl@@c \doconvertRGBtoCMYK#2\to\@@cl@@m \doconvertRGBtoCMYK#3\to\@@cl@@y \let\@@cl@@k\@@cl@@z} well, you can spent the rest of the evening writing an alternative ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context