From: John J. <j.j...@nt...> - 2018-03-27 14:42:23
|
Sorry, a third thing. You need to marshal the input & output colour data using a special array format, because the bindings don't do that automatically. You need to do something like this: RGB = [255,255,255] rgb_in = uint8Array(in_comps * n_pixels) Lab_out = doubleArray(out_comps * n_pixels) for i in range(in_comps * n_pixels): rgb_in[i] = RGB[i] cmsDoTransform(....) Lab_tuple = tuple(Lab_out[i] for i in range(out_comps * n_pixels)) The test_05_transform_rgb_Lab test gives an example of what you should be doing. Sorry, that's the way it is until effort is put into doing automatic marshalling to/from Python lists. John On 27/03/2018 15:22, John Jefferies wrote: > > Hi, > The first thing, cmsCIExyY() shouldn't be used as the white point of > the Lab profile. It is initialised to (0, 0, 0) which obviously isn't > right. You probably want cmsD50_xyY() instead. > > The second thing. The format of the RGB data is TYPE_RGB_DBL. That > doesn't match the [255, 255, 255] that's used. Use TYPE_RGB_8 instead. > > I haven't tested the result of applying these, but it should get you > further. > > John > > On 27/03/2018 10:12, Gonzalez Cano, Jordi wrote: >> >> I would like to use the LCMS with python, but when I want to call the >> function cmsDoTransform the following error appears: /TypeError: in >> method 'cmsDoTransform', argument 2 of type 'void const *'/ >> >> What I am sending to the cmsDoTransform si the following: >> >> /array = [255,255,255]/ >> >> /labColor = lcmsF.transformToLab(array,profileInURL,"RGB","perceptual")/ >> >> // >> >> /--------------- / >> >> // >> >> /def transformToLab(inputColor, profileInURL, formatIn, intent, BPC = >> True):/ >> >> / LabColor = []/ >> >> // >> >> / labProfile = lcms.cmsCreateLab4Profile(lcms.cmsCIExyY())/ >> >> / inputProfile = lcms.cmsOpenProfileFromFile(profileInURL, "r")/ >> >> // >> >> / if(formatIn == "RGB"):/ >> >> / inType = lcms.TYPE_RGB_DBL/ >> >> / elif(formatIn == "CMYK"):/ >> >> / inType = lcms.TYPE_CMYK_DBL/ >> >> // >> >> / if(intent == "perceptual"):/ >> >> / m_intent = lcms.INTENT_PERCEPTUAL/ >> >> // >> >> / if(BPC):/ >> >> / m_BPC = lcms.cmsFLAGS_BLACKPOINTCOMPENSATION/ >> >> / else:/ >> >> / m_BPC = 0/ >> >> / transform = lcms.cmsCreateTransform(inputProfile, inType, >> labProfile, lcms.TYPE_Lab_DBL, m_intent, m_BPC)/ >> >> // >> >> */ lcms.cmsDoTransform(transform,inputColor, LabColor, DIM_OUT)/* >> >> / return LabColor/ >> >> // >> >> How I am supposed to do it? >> >> Thanks, >> >> Jordi G.C. >> >> >> >> ------------------------------------------------------------------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org!http://sdm.link/slashdot >> >> >> _______________________________________________ >> Lcms-user mailing list >> Lcm...@li... >> https://lists.sourceforge.net/lists/listinfo/lcms-user > |