I need to convert CYMK image bytes to bytes for an RGB image.
I think you can skip header bytes and convert the other bytes to RGB, and then change the header bytes for the RGB
format.
What header bytes should be changed for RGB
?
What is the formula for converting color to bits without an ICC profile?
Can someone help me fill out this code?
//Decode with inSampleSize Bitmap Resultbitmap; string path = "imageFileCmyk.jpg"; int scale=4; BitmapFactory.Options o2 = new BitmapFactory.Options(); o2.inPurgeable = true; o2.inSampleSize=scale; o2.inDither = false; Resultbitmap = BitmapFactory.decodeStream(new FileInputStream(path), null, o2); if (Resultbitmap==null) // Warning!! unsupported color conversion request { File tmpfile = new File(path); FileInputStream is = new FileInputStream(tmpfile.getPath()); byte[] cmykBytes= new byte[(int)tmpfile.length()]; byte[] rgbBytes= new byte[(int)tmpfile.length()]; is.read(cmykBytes); for (int i = 0; cmykBytes.length>i; ++i) { if (i>11) // skip header bytes, is it correct ?? { rgbBytes[i] = cmykBytes[i]?? // How ?? } } // new header bytes for RGB format rgbBytes[??]= ?? // How ?? Resultbitmap = BitmapFactory.decodeByteArray(rgbBytes, 0, rgbBytes.length, o2); } return Resultbitmap;
Thanks,
Alberto
source share