-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The cmsCreateTransform may modify the profile in some way #273
Comments
Hi, After investigation, I found the profile PYCC.pf is broken. It uses for Tag AToB0, which is of type LutAToBType, the following sequence: A ->CLUT->M->Matrix This is not allowed in the ICC spec, https://www.color.org/specification/ICC1v43_2010-12.pdf To explain this weird behaviour, lcms is relaxed when reading files and strict when writing them. It accepts the profile for read but it cannot write it. Why sometimes you can save it? If you just save the profile after opening it, lcms does not decode the tags but just does a blind memory copy. This is required to make things go fast when embedding profiles. If you use the profile, then parsing happens and the tag cannot be saved anymore. I agree this is very confusing and should be fixed somehow. I will try to allow saving this profile by using an indentity for B matrix. |
I was going to make lcms to refuse this profile, as it is wrong, but after thinking on that I guess it is better to keep accepting it as a matter of compatibility. The actual behavior is correct, opening such a broken profile is a plus. Allowing to save it would be an error. |
I have found this issue while working on lcms support in the OpenJDK. Some profiles cannot be saved to the memory if they were used by the cmsCreateTransform(). Tested on LittleCMS 2.12.
For example this profile:
https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/sun/java2d/cmm/profiles/PYCC.pf
The test code:
The code above will print:
But if the block of code is commented(or just remove the cmsCreateTransform and cmsDeleteTransform) out in the example, then cmsSaveProfileToMem/cmsOpenProfileFromMem will work fine.
The text was updated successfully, but these errors were encountered: