color.js icon indicating copy to clipboard operation
color.js copied to clipboard

Convert utility claims to have gamut mapped an in-gamut ACEScc color

Open svgeesus opened this issue 1 year ago • 2 comments

Converting oklab(0 0 0) to ACEScc returns color(acescc -0.3584 -0.3584 -0.3584) which it says has been gamut mapped. The un-gamut-mapped converted value is not listed.

svgeesus avatar Dec 15 '23 20:12 svgeesus

Raw coords are -0.35844748858447484, -0.35844748858447484, -0.35844748858447484

In the source we have

// the smallest value which, in the 32bit IEEE 754 float encoding,
// decodes as a non-negative value
const ACES_min_nonzero = -0.35828683;

but there is no specification link for that value, or why it was copied at that precision.

svgeesus avatar Dec 15 '23 20:12 svgeesus

This is stated as non-zero values, oklab(0 0 0) would be a zero value return. This is also comparing 32 bit values, but JS is using 64 bit values.

Considering that 32 bit has ~7 decimal places of precision, that is probably correct as seen below.

>>> Color('acescc', [-0.35828683] * 3).convert('aces2065-1').coords()
[5.959876951435854e-08, 5.9598769514358546e-08, 5.9598769514358546e-08]
>>> Color('acescc', [-0.35844748858447484] * 3).convert('aces2065-1').coords()
[0.0, 0.0, 0.0]

facelessuser avatar Dec 15 '23 21:12 facelessuser