[comp.graphics] RGB to CYMK?? Anybody know of an algorthim??

rotberg@dms.UUCP (Ed Rotberg) (03/14/91)

Hi,

I'm looking for an algorithm or reference to one that would allow me to
convert RGB values to CYMK and vice versa.  An alternative would be
the conversion to and from HSV from CYMK.  Thanks for any and all help.

I'd prefer email, but if it bounces or you'd just rather, please post
any responses here.

Thanks in advance for your help.

	- Ed Rotberg -
	- Atari Games Corp. -

ans@cs.city.ac.uk (Ashley Salisbury) (03/18/91)

In article <1222@dms.UUCP> rotberg@dms.UUCP (Ed Rotberg) writes:
>Hi,
>
>I'm looking for an algorithm or reference to one that would allow me to
>convert RGB values to CYMK and vice versa.  An alternative would be
>the conversion to and from HSV from CYMK.  Thanks for any and all help.
..
>	- Ed Rotberg -
>	- Atari Games Corp. -

I too would very much like some info on this .. preferably some C source
code eg:

struct HSV * rgb_to_hsv_conv(struct RGB *);

type functions. The defintions of HSV RGB etc etc blah are all well documented
in numerous graphics books, but few give details on conversion techniques,
most stopping short of the trivial RGB to intensity conversion. Someone
must have some code for this, which is not so large that it can't be posted.

Please no flames, just put it down to being young and impetuous,

thank's in advance,

Ashley.

billd@fps.com (Bill Davidson) (03/23/91)

>In article <1222@dms.UUCP> rotberg@dms.UUCP (Ed Rotberg) writes:
>>I'm looking for an algorithm or reference to one that would allow me to
>>convert RGB values to CYMK and vice versa.  An alternative would be
>>the conversion to and from HSV from CYMK.  Thanks for any and all help.

In article <1991Mar18.120406.4427@cs.city.ac.uk> ans@city.cs.ac.uk (Ashley Salisbury) writes:
>I too would very much like some info on this .. preferably some C source
>code eg:

Foley & van Dam & Feiner & Hughes (this is getting harder to type with
the additional authors ;-) gives this algorithm on pages 588-589
(Pascal'ish pseudo-code converted to C'ish pseudo-code):

Given R,G,B:

	C = 1 - R;
	M = 1 - G;
	Y = 1 - B;

	K = min(C,M,Y);
	C -= K;
	M -= K;
	Y -= K;

This causes black to be used in place of equal amounts of CMY.  You
should also look at the warnings at the bottom of page 600.  This
algorithm looks nice and neat.  The real world of 4 color printing
isn't so nice and neat but this algorithm is a good starting point.
Come to think of it, RGB isn't so nice and neat when you consider
gamma errors (and worse) for CRT's.

--Bill Davidson
-- 
*ANOTHER* dumb move! -- Dick Spanner, Private Investigator