0

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.

Rais Alam
  • 6,970
  • 12
  • 53
  • 84
Niladri_Android
  • 145
  • 1
  • 12

1 Answers1

0

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: How do I convert images between CMYK and RGB in ColdFusion (Java)?

Hope that helps :3

Community
  • 1
  • 1
Keenora Fluffball
  • 1,647
  • 2
  • 18
  • 34