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
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to