Skip to content
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

ICC transforms with XYZ PCS don't roundtrip correctly #3150

Closed
jcupitt opened this issue Nov 8, 2022 · 4 comments
Closed

ICC transforms with XYZ PCS don't roundtrip correctly #3150

jcupitt opened this issue Nov 8, 2022 · 4 comments
Labels

Comments

@jcupitt
Copy link
Member

jcupitt commented Nov 8, 2022

This works:

vips icc_import input.jpg t1.v
vips icc_export t1.v output.jpg

But this has a visible colour difference:

vips icc_import input.jpg t1.v --pcs xyz
vips icc_export t1.v output.jpg

See libvips/php-vips#169

@jcupitt jcupitt added the bug label Nov 8, 2022
@romanzks
Copy link

I did a little research and noticed that the bug has been reproducible since version 8.11.0.
In earlier versions, error "icc_import: no input profile" is issued.

@jcupitt
Copy link
Member Author

jcupitt commented Nov 19, 2022

I did a little digging and I think the issue is that these two paths are not exactly equal:

device rgb -> icc_import(pcs=xyz) -> xyz 
device rgb -> icc_import(pcs=lab) -> lab2xyz -> xyz

ie. the lcms option to output xyz does not give exactly the same results as requesting lab, and then using the libvips lab2xyz. Perhaps lcms is using D50 lab, and libvips is using D65 lab?

I'll try reading the lcms sources and see if I can find the formula they are using.

@kleisauke
Copy link
Member

It looks like passing cmsFLAGS_NOOPTIMIZE would fix this. See e.g. work-in-progress commit kleisauke@678443c.

@kleisauke
Copy link
Member

I just opened PR #3368 for this.

kleisauke added a commit to kleisauke/libvips that referenced this issue Mar 3, 2023
kleisauke added a commit to kleisauke/libvips that referenced this issue Mar 3, 2023
kleisauke added a commit to kleisauke/libvips that referenced this issue Mar 4, 2023
Avoids the need to pack the buffer of floats into lcms's fixed-point
formats and ensures full precision internally in lcms.

Resolves: libvips#3150.
Supersedes: libvips#3368.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants