[Lcms-user] Transform problems with LCMS in AS3/Alchemy
An ICC-based CMM for color management
Brought to you by:
mm2
From: Adam O. <ols...@gm...> - 2011-04-20 16:02:38
|
Hey list members, I've been working on porting LCMS to Alchemy so I can convert Adobe RGB to sRGB. I've got everything working except it's not transforming properly. I can send it the ICC profile from the .jpg file and it will read it correctly. I can send data to C and it seems to be in the right order (A, R, G, B. No endian problems it seems). It seems to read everything properly, but the final transformed image comes out incorrect. If anyone could let me know if the transform code I'm using is wrong that would be great! Here's the original image http://nothotbutspicy.com/jpghelp/adobeRGB.jpg Here's the image I get from LCMS http://nothotbutspicy.com/jpghelp/sRGB%20(without%20profile).jpg This is the code I'm using to convert (sourceImageStream is a FILE* created from an Alchemy ByteArray of Flash BitmapData. DestImageStream is the same. Flash BitmapData is stored as ARGB_8. size_amt is number of bytes in the sourceImageStream) cmsHTRANSFORM hTransform = cmsCreateTransform(sourceProfile, TYPE_ARGB_8, destProfile, TYPE_ARGB_8, INTENT_PERCEPTUAL, 0); unsigned char *bufferSourceARGB = (unsigned char*)malloc(sizeof(unsigned char) * argb_pixel_size); while(bytesRead < size_amt) { bytesRead += fread(bufferSourceARGB, 1, argb_pixel_size, sourceImageStream); cmsDoTransform(hTransform, bufferSourceARGB, bufferSourceARGB, 1); bytesWritten += fwrite(bufferSourceARGB, 1, argb_pixel_size, destImageStream); } Thanks for your help! Adam |