Hi!

I'm want to convert a CMYK image to a RGB image using VisualC++6.0 and CMM.

The code looks like this:

Input :
inputPixels - a structure with the pixels from the image
profile1 - char* the name for the CMYK file profile
profile2 - char* the name for the RGB file profile

Output :
outputPixels- the output pixels


HPROFILE inputProfile, outputProfile;
HTRANSFORM transform;
BOOL result;
int nPixels = columns * rows;

inputProfile = OpenColorProfileFromFile(profile1);
outputProfile = OpenColorProfileFromFile(profile2);

PHPROFILE pProf = (PHPROFILE)malloc(sizeof(HPROFILE)*2);
pProf[0] = inputProfile;
pProf[1] = outputProfile;

PDWORD intent = (PDWORD)malloc(sizeof(DWORD));
intent[0] = INTENT_SATURATION;
transform = CreateMultiProfileTransform(pProf,2, intent,1, BEST_MODE, 2);
if (transform == NULL)
{
ShowError(GetLastError());
}

outputPixels = (PixelStruct*)malloc(sizeof(PixelStruct)*nPixels);

result = TranslateBitmapBits(transform, inputPixels, BM_KYMCQUADS, columns, rows, 0, outputPixels, BM_xBGRQUADS,0,NULL,0);

if (!result)
{
ShowError(GetLastError());
return NULL;
}

return outputPixels;
}

This code show the image, but not quite good.
Those anyone know how to do that.

P.S. Using the profile1 and profile2 files, in Photoshop the result image is correct.