I’ve got a project where the I need to encode a jpeg in CMYK and I was wondering whether any of you you knew of any means to do this?
I’ve found a cracking script that converts individual rgb ‘points’ to CMYK values but I’m getting stuck when trying to amend the RGB2YUV function in the standard (adobe) jpegEncode – obviously this has to change to allow the four values but should I use another colour profile other than YUV?
private function RGB2YUV(source:Object, xpos:int, ypos:int, width:int=0, height:int=0):void
{
var pos:int = 0;
for (var y:int = 0; y < 8; y++)
{
for (var x:int = 0; x < 8; x++)
{
var P:uint = getPixel32(source, xpos+x, ypos+y, width, height);
var R:Number = Number((P>>16)&0xFF);
var G:Number = Number((P>> 8)&0xFF);
var B:Number = Number((P )&0xFF);
YDU[pos]=((( 0.29900)*R+( 0.58700)*G+( 0.11400)*B))-128;
UDU[pos]=(((-0.16874)*R+(-0.33126)*G+( 0.50000)*B));
VDU[pos]=((( 0.50000)*R+(-0.41869)*G+(-0.08131)*B));
pos++;
}
}
}
I’ve amended the ‘paramers’ of the jpeg creation so that 8 bits/4 components are specified but have hit a brick wall…
Any help would be fantastic.
Many thanks in advance,
Partimer