![]() |
RGB/CMK/CMYK conversions
Delphi-Quellcode:
Formulas I got from EasyRGB. Result are different in this code and Photoshop:
procedure _CMYToCMYK(const C, M, Y: Single; out Cyan, Magenta, Yellow, Black: Single);
var var_K: Single; begin var_K := 1; if C < var_K then var_K := C; if M < var_K then var_K := M; if Y < var_K then var_K := Y; if var_K = 1 then begin //Black Cyan := 0; Magenta := 0; Yellow := 0; end else begin Cyan := (C - var_K) / (1 - var_K); Magenta := (M - var_K) / (1 - var_K); Yellow := (Y - var_K) / (1 - var_K); end; Black := var_K; end; procedure _CMYKToCMY(const C, M, Y, K: Single; out Cyan, Magenta, Yellow: Single); begin Cyan := (C * (1 - K) + K); Magenta := (M * (1 - K) + K); Yellow := (Y * (1 - K) + K); end; procedure _RGBToCMY(const R, G, B: Byte; out C, M, Y: Single); begin C := 1 - (R / 255); M := 1 - (G / 255); Y := 1 - (B / 255); end; procedure _CMYToRGB(const C, M, Y: Single; out R, G, B: Byte); begin R := Round((1 - C) * 255); G := Round((1 - M) * 255); B := Round((1 - Y) * 255); end; procedure _RGBToCMYK(const R, G, B: Byte; out C, M, Y, K: Single); var Cyan, Magenta, Yellow: Single; begin _RGBToCMY(R, G, B, Cyan, Magenta, Yellow); _CMYToCMYK(Cyan, Magenta, Yellow, C, M, Y, K) end; procedure _CMYKToRGB(const C, M, Y, K: Single; out R, G, B: Byte); var Cyan, Magenta, Yellow: Single; begin _CMYKToCMY(C, M, Y, K, Cyan, Magenta, Yellow); _CMYToRGB(Cyan, Magenta, Yellow, R, G, B); end;
Code:
Where is bug? :sad:
_CMYKToRGB(0.11, 0.13, 0.99, 0, R, G, B); // 227 222 3; ps: 232, 207, 30
_CMYKToRGB(0, 0, 0.5, 0.5, R, G, B); // 124 124 64; ps: 150 145 91 |
AW: RGB/CMK/CMYK conversions
Zitat:
Zitat:
Mngenta <=> Green Yellow <=> Blue Aber eigentlich ist es so: Cyan <=> Blue und Green Mangenta <=> Blue und Red Yellow <=> Red und Green |
Re: RGB/CMK/CMYK conversions
Hm, what is valid formula? I saw on the Internet only this one.
|
AW: RGB/CMK/CMYK conversions
Except from the rounding mismatches in ur formula
![]() did u switch off the Color Management in PS? ;) |
Re: RGB/CMK/CMYK conversions
@Sir Rufo, what is wrong in this code, please tell me :(
I set color management policies to off, when was off the same as now. |
AW: RGB/CMK/CMYK conversions
try Extended instead of Single
|
Re: RGB/CMK/CMYK conversions
Could you please explain me why? Why is required extended precision?
|
AW: RGB/CMK/CMYK conversions
Hi WojTec,
have you already found a solution for this? jus |
AW: RGB/CMK/CMYK conversions
This could help !
![]() Keyword: RealColorLibrary Greetings, Alfred. |
AW: RGB/CMK/CMYK conversions
The formulas in the link from donalfredo seems to be very similiar to Wojtec. I did some research for myself. I get also very similiar results from photoshop as wojtec depending on which profiles i set. I think the differences come from the adobe colormanagement engine. So the photoshop does a full color space conversion between icc profiles and such approximation formulas like "C:=1-(R/255)..." don't work any more.
:) jus |
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:37 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz