Skip to content

colour: use suggested rendering intent as fallback #4347

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

Merged
merged 1 commit into from
Jan 24, 2025

Conversation

kleisauke
Copy link
Member

@kleisauke kleisauke commented Jan 20, 2025

When the requested rendering intent is not supported by the profile, fallback to the profile's suggested intent. An error will only be raised if the suggested intent is also unsupported.

Resolves: #3475.

Targets the 8.16 branch.

Copy link
Member

@lovell lovell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really useful, thanks Kleis.

Copy link
Member

@jcupitt jcupitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we should change the default intent. This could change the behaviour of a lot of old code.

@@ -785,7 +789,7 @@ vips_icc_class_init(VipsIccClass *class)
static void
vips_icc_init(VipsIcc *icc)
{
icc->intent = VIPS_INTENT_RELATIVE;
icc->intent = VIPS_INTENT_AUTO;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't changing the default break a lot of old code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't encountered any issue with this in the test suite or with various sample images tested locally. The benefit of this approach is that processing XYB JPEG images will work out-of-the-box. Otherwise, you might get a green-ish image if the embedded profile is ignored, along with a warning saying: profile does not support relative input intent.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about picking the user's requested rendering intent, and if that's not available, falling back to the profile's suggested intent? Then only raising an error if both are missing.

We wouldn't need the AUTO setting, and libvips behaviour with old code would not change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! I've incorporated this in the latest changeset and also targeted the 8.16 branch instead.

When the requested rendering intent is not supported by the profile,
fallback to the profile's suggested intent. An error will only be
raised if the suggested intent is also unsupported.

Resolves: libvips#3475.
@kleisauke kleisauke changed the base branch from master to 8.16 January 24, 2025 12:43
@kleisauke kleisauke changed the title colour: add support for auto-selecting the rendering intent colour: use suggested rendering intent as fallback Jan 24, 2025
Copy link
Member

@jcupitt jcupitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woo!

@jcupitt jcupitt merged commit 3848af5 into libvips:8.16 Jan 24, 2025
6 checks passed
@kleisauke kleisauke deleted the issue-3475 branch January 24, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add default-intent ICC rendering intent
3 participants