Alexei,
below a example how the linear RGB profile.
You can of course take some other standard values.
void
write_profile(float gamma, float rx, float ry, float gx,
float gy,
float bx, float by) {
cmsCIExyYTRIPLE p = {{rx,ry},{gx,gy},{bx,by}};
LPGAMMATABLE g[3];
g[0] = g[1] = g[2] = cmsBuildGamma(1, gamma);
cmsHPROFILE hp = cmsCreateRGBProfile( cmsD50_xyY(),
&p, g);
_cmsSaveProfile( hp, "matrixRGB.icc" );
cmsCloseProfile(hp);
}
regards
Kai-Uwe Behrmann
--
development for color management
www.behrmann.name + www.oyranos.org + www.cinepaint.org
Am 12.03.07, 16:19 -0700 schrieb Alexei Puzikov:
> Hello,
>
> I've tried to find out the answer to this question in
tutorial,
> samples sources and in the mailing list, but failed to
achieve the
> required results.
>
> So, I have lots of TIFF files created on Macs with
Adobe Photoshop.
> Some of them are in sRGB; most of them are in AdobeRGB.
All of them
> have the corresponding ICC profiles embedded inside.
>
> So, I need to convert them to linear color space,
basically, by going
> >from sRGB (approx. gamma 2.2, but the exact
algorithm is slightly
> different) and AdobeRGB (also almost 2.2). Previously
I've been
> working with sRGB only and used some custom math, but
now we're
> switching to AdobeRGB and I don't want to touch the
math anymore, so I
> want to switch to LCMS for conversion.
>
> The problem is - how do I create the linear gamma 1.0
profile and
> corresponding transform?
>
> LPGAMMATABLE Transfer[3];
> cmsHPROFILE LinearProfile;
>
> Transfer[0] = cmsBuildGamma(256, 1);
> Transfer[1] = cmsBuildGamma(256, 1);
> Transfer[2] = cmsBuildGamma(256, 1);
>
> LinearProfile =
cmsCreateLinearizationDeviceLink(icSigRgbData, Transfer);
>
> doesn't work:
>
> int iccfound = 0;
> iccfound = TIFFGetField(in, TIFFTAG_ICCPROFILE,
&profile_size, &icc_profile);
> if (iccfound) {
> TiffProfile =
cmsOpenProfileFromMem(icc_profile, profile_size);
> }
>
> and then
>
> DWORD PixelType = TYPE_RGBA_16;
> hTransform = cmsCreateTransform(TiffProfile,
>
PixelType,
>
LinearProfile,
>
PixelType,
>
INTENT_PERCEPTUAL, 0);
>
> results in error 12288: invalid PCS. And I still think
it shouldn't,
> since it's not real profile per se.
>
> So what's the basic idea? How can I create the linear
profile without
> reverting to some ICC files I have no idea where to get
from?
>
> Sorry if the question is dumb, but I'm really out of
ideas.
>
> Alexei Puzikov
>
------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Lcms-user mailing list
Lcms-user lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user
|