Identifying Profiles is Hard
Given an ICC profile, identifying the colorspace it describes (e.g., “sRGB” or “Display P3”) is hard.
See There Is No Single sRGB Color Profile, and note that technically Profiles Aren’t Interchangable Even When They Describe the Same Colorspace.
Relying on the description string in the profile is fraught. Not all profiles will identify the colorspace they describe, or even have useful descriptions. It’s also insufficient to look at just the illuminant and primaries, since that won’t catch differences in the tone response curves (e.g., linear vs gamma 1.8 vs gamma 2.2). And the tone response curves can’t be compared unless you actually do the math, since they can be encoded with a different number of points, or as a parametric curve.
An Approach
I’m using this set of steps to identify an unknown RGB color profile.
- Choose a set of test RGB colors. There need to be enough test colors to differentiate, for example, linear vs gamma 2.2, so testing just the extremes of the colorspace isn’t enough.
- Assign the unknown profile to those test colors, then convert them to a device-independent colorspace like L*a*b*.
- Consider a known reference profile as a test candidate. Assign that profile to the test colors, then convert them to L*a*b* as well.
- For each test color, compare the pairs of L*a*b* colors. If the is greater than some threshold (I’m using a threshold much less than for now), reject the reference profile as a match.