views:

47

answers:

1

Hi Everybody, I have an doubt, I don't know how to use cmyk colors in android. If any one knows please help me. I am waiting for your valuable replies.

Thanks & REgards Niladri

A: 

You just need a function, which converts the CMYK value to RGB? Or do you want to convert a whole image, which is CMYK?

For the first problem, as pseudocode rgb2cmyk:

int r,g,b,c,m,y,k;
int computedC,computedM,computedY;
int minCMY;

if(r==0 && g==0 && b==0) return {0,0,0,1}

computedC = 1 - (r/255);
computedM = 1 - (g/255);
computedY = 1 - (b/255);

minCMY = Math.min(computedC,Math.min(computedM,computedY));

computedC = (computedC - minCMY) / (1 - minCMY) ;
computedM = (computedM - minCMY) / (1 - minCMY) ;
computedY = (computedY - minCMY) / (1 - minCMY) ;

return {computedC,computedM,computedY,minCMY};

And for the other way around, just calculate it backwards :)

For the problem no. 2: Its easier, 'cause there is a special tool called ColorSpace: http://stackoverflow.com/questions/22409/how-do-i-convert-images-between-cmyk-and-rgb-in-coldfusion-java

Hope that helps :3

Keenora Fluffball