dbeck@unix.SRI.COM (Douglas K. Beck) (03/26/89)
Does someone have some good ideas and/or snippets of C code for doing RGB -> CYMK conversion? TIA. ...doug beck dbeck@unix.sri.com
thawk1@ibmpcug.UUCP (Timothy Hawkins) (03/28/89)
I too am looking for information about this subject... I general I would like some pointers towards YMCK<->RGB and RGB<->HSB.. It looks like this information is of general interest... -- Automatic Disclaimer: The views expressed above are those of the author alone and may not represent the views of the IBM PC User Group.
btc@hpcvlx.HP.COM (Bob Clark) (03/29/89)
Try section 17.4 of "Fundamentals of Interactive Computer Graphics" by J.D. Foley and A. VanDam - Addison_Wesley 1982. Bob Clark Hewlett-Packard PCD Corvallis, OR {ucbvax!hplabs, harpo, ogcvax}!hp-pcd!hpcvlo!btc btc%hp-pcd@hplabs.hp.com
jlg@hpfcdq.HP.COM (Jeff Gerckens) (03/30/89)
> Does someone have some good ideas and/or snippets of C code > for doing RGB -> CYMK conversion? TIA. ...doug beck > dbeck@unix.sri.com A good basic coverage of color space conversions appears in both Rogers and Foley and Van Dam's texts on graphics, although care should be taken with older revisions. They do contain some errors. The basic conversion for RGB -> CMY is: [ C M Y ] = [ 1 1 1 ] - [ R G B ] The K is black and is used when C=M=Y=1 (or within some user defined tolerance). This is because most inks used don't do a very good job at mixing to form black. -- Jeff Gerckens, Hewlett-Packard Graphics Technology Division jlg%hpfcrg@hplabs.hp.com "Nice computers don't go down."
hutch@rawfish.celerity (Jim Hutchison) (04/06/89)
RGB -> CMYK is not as simple as it might initially appear. Note for convenience all color values below are normalized. Gunk is the non-technical term I will use for ink/wax/jam. If you are taking RGB to perfect CMYK, the operation is trivial, you set K=0, C=1-(B+G)/2, M=1-(B+R)/2, Y=1-(R+G)/2. Unfortunately C,M,Y=1,1,1 is a lousy black. It has too much gunk on the page, and is a color which I've seen to vary from bluish to brownish black. So, in comes black. You want black to be a good solid black without having 3 times the amount of gunk on the page to do it. An initial guess would be to make the transformation with as much black as possible; K=1-min(RGB), C=C-K, M=M-K, Y=Y-K. This puts the least ink on the page, and works. Unfortunately this really brings out the detail of the print screen used and makes the print look a little garish (atleast to me). So a next obvious step is to do the black by percentage. 60-80% seems to be what Hell suggests in their GCR (under color correction) poster. Now that that is over with, on to gunk correction. The unfortunate thing about gunk (be it ink, wax, or some other pigment) is that it is not pure in its absorption of color. So you need to do a map from RGB to CMY. Luckily this is R3->R3 so there should be only 1 right answer, ignoring sampling frequency. Unfortunately I can't tell you the best way I know to do this, as I don't own it. The gist of the problem is to figure out how much of each R, G, and B are absorbed by each C, M, and Y. Black is excellent, you should not have to ever worry about black (with any of today's standard black pigments). Ramps of uncorrected R, G, and B checked with a densitometer should get you in the ballpark. /* Jim Hutchison {dcdwest,ucbvax}!ucsd!celerity!hutch */ /* Disclaimor: I am not a official spokesman for FPS computing */
hutch@net1.ucsd.edu (Jim Hutchison) (04/06/89)
RGB -> CMYK is not as simple as it might initially appear. Note for convenience all color values below are normalized. Gunk is the non-technical term I will use for ink/wax/jam. If you are taking RGB to perfect CMYK, the operation is trivial, you set K=0, C=1-(B+G)/2, M=1-(B+R)/2, Y=1-(R+G)/2. Unfortunately C,M,Y=1,1,1 is a lousy black. It has too much gunk on the page, and is a color which I've seen to vary from bluish to brownish black. So, in comes black. You want black to be a good solid black without having 3 times the amount of gunk on the page to do it. An initial guess would be to make the transformation with as much black as possible; K=1-min(RGB), C=C-K, M=M-K, Y=Y-K. This puts the least ink on the page, and works. Unfortunately this really brings out the detail of the print screen used and makes the print look a little garish (atleast to me). So a next obvious step is to do the black by percentage. 60-80% seems to be what Hell suggests in their GCR (under color correction) poster. Now that that is over with, on to gunk correction. The unfortunate thing about gunk (be it ink, wax, or some other pigment) is that it is not pure in its absorption of color. So you need to do a map from RGB to CMY. Luckily this is R3->R3 so there should be only 1 right answer, ignoring sampling frequency. Unfortunately I can't tell you the best way I know to do this, as I don't own it. The gist of the problem is to figure out how much of each R, G, and B are absorbed by each C, M, and Y. Black is excellent, you should not have to ever worry about black (with any of today's standard black pigments). Ramps of uncorrected R, G, and B checked with a densitometer should get you in the ballpark. /* Jim Hutchison {dcdwest,ucbvax}!ucsd!net1!hutch */
jlg@hpfcdq.HP.COM (Jeff Gerckens) (04/11/89)
> / hpfcdq:comp.graphics / hutch@net1.ucsd.edu (Jim Hutchison) / 11:38 pm Apr 5, 1989 / > RGB -> CMYK is not as simple as it might initially appear. > Note for convenience all color values below are normalized. > Gunk is the non-technical term I will use for ink/wax/jam. > > If you are taking RGB to perfect CMYK, the operation is trivial, > you set K=0, C=1-(B+G)/2, M=1-(B+R)/2, Y=1-(R+G)/2. No, [ R G B ] = [ 1 1 1 ] - [ C M Y ]. > Unfortunately C,M,Y=1,1,1 is a lousy black. It has too much gunk Yes. > on the page, and is a color which I've seen to vary from bluish to > brownish black. So, in comes black. You want black to be a good > solid black without having 3 times the amount of gunk on the page > to do it. An initial guess would be to make the transformation > with as much black as possible; K=1-min(RGB), C=C-K, M=M-K, Y=Y-K. > This puts the least ink on the page, and works. Unfortunately > this really brings out the detail of the print screen used and > makes the print look a little garish (atleast to me). So a next > obvious step is to do the black by percentage. 60-80% seems to > be what Hell suggests in their GCR (under color correction) poster. K=min(CMY) , preferably with some threshold (&& K > .6), C=C-K, M=M-K, Y=Y-K as before. > Now that that is over with, on to gunk correction. The unfortunate > thing about gunk (be it ink, wax, or some other pigment) is that > it is not pure in its absorption of color. So you need to do a map > from RGB to CMY. Luckily this is R3->R3 so there should be only 1 ^^^^^^^^ Actually this is best accomplished by primary conversion using the CIE 1931 XYZ space as a standard, measurable intermediate. A brief description of the analogous procedure for phosphors appears in Rogers (Procedural Elements for Computer Graphics). > right answer, ignoring sampling frequency. Unfortunately I can't > tell you the best way I know to do this, as I don't own it. The > gist of the problem is to figure out how much of each R, G, and B > are absorbed by each C, M, and Y. Black is excellent, you should > not have to ever worry about black (with any of today's standard > black pigments). Ramps of uncorrected R, G, and B checked with a > densitometer should get you in the ballpark. Or call the manufacturer to get the CIE (x,y) chromaticities of the gunks and your monitor. Or use a colorimeter. > > /* Jim Hutchison {dcdwest,ucbvax}!ucsd!net1!hutch */ -- Jeff Gerckens jlg%hpfcrg@hplabs.hp.com