>Does anybody tell me a more accurated way to convert CMYK to RGB and
>viceversa (es. like Adobe Photoshop)
I'm going to assume that your RGB values range from 0 to 255, and your
CMYK values range from 0 to 100.
RGB -> CMYK
C := 100 - Round(100 * R / 255);
M := 100 - Round(100 * G / 255);
Y := 100 - Round(100 * B / 255);
K := C;
if M < K
then K := M;
if Y < K
then K := Y;
C := C - K;
M := M - K;
Y := Y - K;
CMYK -> RGB
R := 255 - Round(2.55 * (C + K));
if R < 0 then
R := 0;
G := 255 - Round(2.55 * (M + K));
if G < 0 then
G := 0;
B := 255 - Round(2.55 * (Y + K));
if B < 0 then
B := 0;
-Steve
I was unable to find FAQ 879, however I wrote the following
FAQ(s), and can assure you that they use the same standard
formulas used in commercail graphics packages.
http://www.borland.com/devsupport/delphi/qanda/FAQ2948D.html
http://www.borland.com/devsupport/delphi/qanda/FAQ2728D.html
Joe
--
Joe C. Hecht
http://home1.gte.net/joehecht/index.htm
Bye Uberto
--
Uberto -- D&D Support Team
>>Does anybody tell me a more accurated way to convert CMYK to RGB and
>>viceversa (es. like Adobe Photoshop)
>
Sorry you did not like the FAQ I wrote. Actually, it is right
on the money. If you have to take the next step, then you
would be suffciently knowledgable about the subject as not
to even need the FAQ!
Of course, you can tell a "very better algorithm",
so I suppose you are familiar with the following
standard "end of the road" formula:
The following conversion formula uses UnderColorRemoval()
and BlackGeneration() functions that factor into the
conversions. Be aware that to properly use those functions,
you must actually know the charateristics of the inks you
are using, the paper your printing on, the type of printing
press or device, amounts of inc coverage, anticipated dot
gain, spread, trapping, tempature, humitiy, and so forth....
c := 1.0 - r;
m := 1.0 - g;
y := 1.0 - b;
k := min(c,m,y);
c := min(1.0, max(0.0, c - UCR(k)));
m := min(1.0, max(0.0, m - UCR(k)));
y := min(1.0, max(0.0, y - UCR(k)));
k := min(1.0, max(0.0, y - BG(k)));
Where UCR() is your UnderColorRemoval function
and BG() is your BlackGeneration function.
It just does not get any better than that, providing
you know enough about the device and what your printing
to make it work correctly.
I'm not here to criticize anybody. I've just puncted there are other algos
to covert RGB to CMYK, maybe it'll be better to put a hint on FAQ. ;-)
As you surely know there isn't a perfect CMYK (which is a reflected color
space) to RGB (transparent color space) conversion algorithm. Photoshop use
a decent standard. ;-)
Anyway thanks for your reply.