Ok, got it. Problem is the usage of _cmsSaveProfileToMem, which I assumed would be the last operation just before closing the profile. I really never intended to reuse a profile after it has been saved, so, since this function was doing side effects, I used a "_" as a mark of "internal function".
There are other combinations that doesn't work too. For example, if you open a disk profile h = cmsOpenProfileFromFile(... etc.) you cannot save this profile by using _cmsSaveProfile(). It doesn't work because once you read the profile, some decoding is done in a lousy way. For example, a profile can store a curve as a single gamma exponent, say 2.2. Once cmsOpenProfileFromFile() opens it, this parametric curve is translated to a table, and the information about the original encoding is lost. The difference between a 2.2 number and the expanded table may be about 30K, enough to make embedded profile not suitable at all. v4 profiles makes this problem even worst. Of course this may be regarded as a bug... So, I will try to either document this behavior, fix it in a way you could reuse the profile or at least issue a clear error message. There is a lot of room for improvement in that direction. I guess you want this for embedded profiles right? But then be careful because any disk based profile opened by cmsOpenProfileFromFile() will NOT work with _cmsSaveProfile()/_cmsSaveProfileToMem() Sorry, but current version does allow to read or to create profiles but not both at same time. Regards, Marti Maria The little cms project http://www.littlecms.com [EMAIL PROTECTED] ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ Lcms-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/lcms-user