Displaying 2 results from an estimated 2 matches for "rgb2cmyk".
2008 May 23
0
rgb to cmyk conversion is wrong in src/library/grDevices/src/devPS.c (PR#11509)
...he range [0,1] before the
function was called, so this is almost right. The last line should actually
be something like
else { c = (c - k)/(1 - k); m = (m - k)/(1 - k); y = (y - k)/(1 - k);}
Here is some R code I wrote that does the conversion, so you can see what it's
supposed to be doing:
rgb2cmyk <- function(rgb){
## rgb is a vector of 3 numbers in the 0 to 255 range
## returns cmyk vector of 4 numbers in [0,1]
cmy <- 1 - rgb/255
names(cmy) <- c("c", "m", "y")
k <- min(min(min(1, cmy[1]), cmy[2]), cmy[3])
if(k == 1) c(cmy, k = 1)
else...
2008 May 27
1
(PR#11509) rgb to cmyk conversion is wrong in
...s called, so this is almost right. The last line should actually
> be something like
>
> else { c = (c - k)/(1 - k); m = (m - k)/(1 - k); y = (y - k)/(1 - k);}
>
> Here is some R code I wrote that does the conversion, so you can see what it's
> supposed to be doing:
>
> rgb2cmyk <- function(rgb){
> ## rgb is a vector of 3 numbers in the 0 to 255 range
> ## returns cmyk vector of 4 numbers in [0,1]
> cmy <- 1 - rgb/255
> names(cmy) <- c("c", "m", "y")
> k <- min(min(min(1, cmy[1]), cmy[2]), cmy[3])
> if(k ==...