Hi,

>I have an application with which I can view a TIFF image in RGB space.
> I want to be able to view TIFF images in CIELAB color space.

> How can I use the lcms library to achieve that?

Is quite easy.

//----------------------------------
#include "lcms.h"
int main(void)
{

     cmsHPROFILE hInProfile, hOutProfile;
     cmsHTRANSFORM hTransform;
     int i;


     hInProfile  = cmsOpenProfileFromFile("lcmstiff8.icm", "r");
     hOutProfile = cmsCreate_sRGBProfile(void);


     hTransform = cmsCreateTransform(hInProfile,
                                           TYPE_Lab_8,
                                           hOutProfile,
                                           TYPE_BGR_8,
                                           INTENT_PERCEPTUAL, 0);


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

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

     return 0;
}
//----------------------------------


There are two flavors of TIFF Lab, the 8-bits encoding and 16-bits encoding.
Both are encoded in a mutual incompatible way, so you would need to use two
different profiles.

Use lcmstiff8.icm (http://www.littlecms.com/tiff8adobe.zip) for 8-bit
encoding, or you can use the built-in Lab profile for 16 bits. That is,
replace whole line by

hInProfile = cmsCreateLabProfile(NULL)

Of course, you can also use a monitor/printer output profile instead
of sRGB, in such case you will get full color management as a tip.

Hope this helps,
Mart� Maria
The little cms project
http://www.littlecms.com
[EMAIL PROTECTED]






-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
Lcms-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to