Re: [Lcms-user] How does a transformation work
An ICC-based CMM for color management
Brought to you by:
mm2
|
From: <mar...@li...> - 2023-12-29 14:21:17
|
Ok,
The procedure to create a gray profile is simple.
First measure the transfer function of your gray device to XYZ. That could be a gamma curve or anything.
Then measure the white point of your gray space. The adaptation to D50 is already done by lcms.
Then create a tone curve with your transfer function.
Finally, by using white point and curve, create a profile.
Please note you cannot map contone values for input to output since the output profile is unknown. So, you cannot map 0 to 40 and 255 to 240. You can only characterize which XYZ you get with gray = 0 and gray = 255.
Example:
cmsToneCurve* tone;
cmsUInt16Number curve[256];
int i;
cmsHPROFILE hProfile;
for (i = 0; i < 256; i++)
{
curve[i] = (cmsUInt16Number) round(65535.0 * pow(i / 255.0, 2.2));
}
tone = cmsBuildTabulatedToneCurve16(0, 256, curve);
hProfile = cmsCreateGrayProfile(cmsD50_xyY(), tone);
cmsFreeToneCurve(tone);
cmsSaveProfileToFile(hProfile, "gray_test.icc");
cmsCloseProfile(hProfile);
Regards
Marti Maria
The LittleCMS Project
https://www.littlecms.com
> -----Original Message-----
> From: flap <fb...@oh...>
> Sent: Friday, December 29, 2023 2:21 PM
> To: lcm...@li...
> Subject: Re: [Lcms-user] How does a transformation work
>
> Am Freitag, 29. Dezember 2023, 14:01:40 CET schrieb
> mar...@li...:
> > Hi,
> >
> > From your explanation, it seems to me that the transformation you want
> > has
> nothing to do with color management. You
> > know nothing about the L* of your grayscale and need only some
> > scaling. I
> would rather use simple math in this case:
> >
> > Gray_out = (Gray_in * 40) /51 + 40;
> >
> > You could just use a for() loop. This is going to be faster that using
> > any
> color management routines.
>
> Hmm. It just was a test to understand how it (may) works.
> The profile I create is used in the muPDF library to create a greyscale out from
> a PDF document. I would expect, any kind of PDF could be rasterized into a
> greyscale raster this way.
>
> Cheers,
> Jürgen
>
>
>
>
>
> _______________________________________________
> Lcms-user mailing list
> Lcm...@li...
> https://lists.sourceforge.net/lists/listinfo/lcms-user
|