groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] CMYK <-> RGB


From: Werner LEMBERG
Subject: [Groff] CMYK <-> RGB
Date: Thu, 04 Oct 2001 17:51:02 +0200 (CEST)

Looking into the jpegtopnm program which is part of the netpbm
package, I see the following two algorithms to convert from CMYK to
RGB:

  CMYK_NORMAL_COLORSPACE:

    r = ((maxval-k)*(maxval-c))/maxval;
    g = ((maxval-k)*(maxval-m))/maxval;
    b = ((maxval-k)*(maxval-y))/maxval;

  CMYK_ADOBE_COLORSPACE:

    r = (k*c)/maxval;
    g = (k*m)/maxval;
    b = (k*y)/maxval;

This differs from the formula used in groff (as submitted by Gaius; to
be available soon from the CVS):

    r = maxval - min(maxval, c*(maxval-k)/maxval + k);
    g = maxval - min(maxval, m*(maxval-k)/maxval + k);
    b = maxval - min(maxval, y*(maxval-k)/maxval + k);

[Gaius, your original formula was incorrect; it missed the division by
 `maxval'.]

Which one is the `best' or the `correct' one?


    Werner

reply via email to

[Prev in Thread] Current Thread [Next in Thread]