I'm pretty new to lcms (I've used it a little).  I have the following situation.

I have a color profile monitorProfile.icm that maps Lab colors to RGB colors, and that profile is being used to create a particular JPEG file "monitor.jpg" that is displayed on a monitor.  I no longer have access to the original Lab colors, just the profile and monitor.jpg.  Now, I want to print monitor.jpg., i.e. convert "monitor.jpg" to something that can be printed, i.e. CMYK data, and I have a color profile printerProfile.icm that I can use. 

I've taken an example from the tutorial and modified it as shown below (the only changes I've made are in blue and red):



#include "lcms.h"


int main(void)
{

     cmsHPROFILE hInProfile, hOutProfile;
     cmsHTRANSFORM hTransform;
     int i;


     hInProfile  = cmsOpenProfileFromFile("monitorProfile.icm", "r");
     hOutProfile = cmsOpenProfileFromFile("printerProfile.icm", "r");



     hTransform = cmsCreateTransform(hInProfile,
                                           TYPE_RGB_8,
                                           hOutProfile,
                                           TYPE_CMYK_8,
                                           INTENT_PERCEPTUAL, 0);


     for (i=0; i < AllScanlinesTilesOrWatseverBlocksYouUse; i++)
     {
           cmsDoTransform(hTransform, YourInputBuffer,
                                      YourOutputBuffer,
                                      YourBuffersSizeInPixels);
     }



     cmsDeleteTransform(hTransform);
     cmsCloseProfile(hInProfile);
     cmsCloseProfile(hOutProfile);

     return 0;
}


 Is this the correct way to achieve what I want?  Also, I presume I need to extract the RGB data from the JPEG file and create my own CMYK file (i.e. lcms doesn't handle image file data extraction/creation).

Thanks,

Richard

Reply via email to