Skip to content

Conversation

waacton
Copy link
Collaborator

@waacton waacton commented Sep 18, 2025

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Following on from InternationalColorConsortium/iccDEV#164, colour conversion between ICC profiles can be made more performant by ignoring the PCS illuminant in the header and using the ICC's definition of D50 - avoiding unnecessary chromatic adaptations.

The ICC reference implementation (now called iccDEV, not iccMAX) does not use a profile's PCS illuminant header field during colour conversion, it always uses XYZ (0.9642, 1.0, 0.8249). Some related extracts from the v4 spec:


image
image
image

Only in the latest proposed spec for v5+ does it suggest that non-D50 illuminants are supported, though the values should correspond to a new spectralViewingConditions tag.

So this PR aims to match the behaviour of the reference implementation:

  • Assume all profiles are D50 illuminant (a different value is simply not compatible with the spec)
  • Use ICC D50 (0.9642, 1.0, 0.8249) as the reference white of profiles, which is different than the existing ASTM D50 (0.96422, 1, 0.82521)
  • Reduce test tolerances now that ImageSharp and Unicolour are using the same D50 illuminant value for profile colour conversion

MemoryAllocator = converter.Options.MemoryAllocator,
SourceWhitePoint = new CieXyz(converter.Options.SourceIccProfile.Header.PcsIlluminant),
TargetWhitePoint = new CieXyz(converter.Options.TargetIccProfile.Header.PcsIlluminant),
SourceWhitePoint = KnownIlluminants.D50Icc,
Copy link
Member

Choose a reason for hiding this comment

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

Should we not be testing for a version number < 5 and assigning the value based on the version?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Potentially, though whether the ICC code in ImageSharp can support v5+ correctly at all is another question. I wouldn't be surprised if v5-level features were only added to the reference implementation after it was ported here (and now that the reference has been refactored, could be harder to match up). Adapting between PCS illuminants seems a sensible step but it might not meet v5 spec, given how wordy section 10.2.22 spectralViewingConditionsType is for the svcn tag.

And their description on https://www.color.org/icclabs.xalter tries to emphasise how different v5 is:

this new system is not a simple "dot" release to the V4 spec and that a V5 profile is very different than a V2 or V4

in many industries, v4 (and even v2) meets existing color management needs and in these industries there will be no drive to move to adopt the v5 specification

I've still not got around to implementing full support for v4 profiles in Unicolour so I've largely buried my head in the sand for v5 🙈. I'm hedging my bets that because v4 took painstaking effort to meet, v5 surely can't be a smoother experience.

In summary I think it's a choice between:

  • Explicitly no support for v5 until (or if) it becomes more widely adopted
  • Best attempt to support v5 while acknowledging it might deviate from spec

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for confirming. Yeah, definitely best to deal with V4 for now and V5 if and when it's ever needed.

@JimBobSquarePants JimBobSquarePants merged commit 52c73f3 into main Oct 13, 2025
9 checks passed
@JimBobSquarePants JimBobSquarePants deleted the icc-pcs branch October 13, 2025 03:56
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.

2 participants