|
[Date Index]
[Thread Index]
[Author Index]
Re: RGB to CMYK
- To: mathgroup at smc.vnet.net
- Subject: [mg25547] Re: RGB to CMYK
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Sat, 7 Oct 2000 03:35:51 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <8rjik5$odn@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
with version 4.x you can use
?ToColor
"ToColor[color, form] converts color to form if form is GrayLevel,
RGBColor \
or CMYKColor color is converted into it. Otherwise form[color] is
evaluated \
and the result is expected to be a valid color directive."
In[]:=ToColor[RGBColor[1, 0, 0], CMYKColor]
Out[]=CMYKColor[5.46908`*^-6, 0.9958244690799987`, 0.9958244690799987`,
5.46908`*^-6]
The correct conversion from RGB to CMY is
c=1-r
m=1-g
y=1-b
and from CMY to CMYK
k=min(c,m,y)
c'=(c - k)/(1-k)
m'=(m - k)/(1-k)
y'=(y - k)/(1-k)
Regards
Jens
PS: Yes, the ToColor[] function is not documented in "The Book"
Bernd Brandt wrote:
>
> Hi Group,
>
> I am looking for a conversion function between RGB and CMYK.
> I thought this would not be a problem but i have not found one good function.
>
> The Mathematica book (examples) includes:
>
> CMYKfromRGB[RGBColor[r_, g_, b_]] :=
> CMYKColor[b, r b, 1 - b, (r + g + b)/3]
>
> But this is not correct.
> RGBColor[1,0,0] really red, is converted to CMYKColor[0, 0, 1, 0.5],
> which is clearly not red.
>
> Does someone have a correct function?
>
> Regards,
> Bernd
Prev by Date:
RE:? D[f,{x,n}]
Next by Date:
advanced keystroke remapping
Previous by thread:
Re: RGB to CMYK
Next by thread:
newbie needs help
|