0

just like the title of the question, i want to ask how to create a CMYK image when i have a RGB image as a bitmap. I had reads question that generate the CMYK value from RGB value just like this code

public static int[] rgbToCmyk(int red, int green, int blue)
{
    int black = Math.min(Math.min(255 - red, 255 - green), 255 - blue);

    if (black!=255) {
        int cyan    = (255-red-black)/(255-black);
        int magenta = (255-green-black)/(255-black);
        int yellow  = (255-blue-black)/(255-black);
        return new int[] {cyan,magenta,yellow,black};
    } else {
        int cyan = 255 - red;
        int magenta = 255 - green;
        int yellow = 255 - blue;
        return new int[] {cyan,magenta,yellow,black};
    }
}

but, after i have the CMYK value i still don't understand where to place the value just like Bitmap.setBitmap() on android. as i know the setBitmap function use the RGB value, not CMYK value... there are a way to change the image color type to CMYK in android? I'm a newbie in android, correct me if I wrong..

adi.zean
  • 1,085
  • 3
  • 12
  • 15

1 Answers1

0

The best thing is a library call to convert the format. Try android-lib-magick, described in the Stack Overflow question Android CMYK mode.

Community
  • 1
  • 1
Hew Wolff
  • 1,489
  • 8
  • 17
  • thanks to show me the library @Hew Wolff, but after i add the lib, i have another question,, how to add a bitmap, not a string location.. can i use Bitmap.toString at the ImageInfo? – adi.zean Aug 14 '13 at 02:24