-
Notifications
You must be signed in to change notification settings - Fork 82
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
Calc more accurate inverse matrices for cat and pre-calc D50 <-> D65 #354
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { create, all } from 'mathjs' | ||
const config = {} | ||
const math = create(all, config) | ||
|
||
const d50 = [0.3457 / 0.3585, 1.00000, (1.0 - 0.3457 - 0.3585) / 0.3585] | ||
const d65 = [0.3127 / 0.3290, 1.00000, (1.0 - 0.3127 - 0.3290) / 0.3290] | ||
|
||
const bradford = [ | ||
[0.8951000, 0.2664000, -0.1614000], | ||
[-0.7502000, 1.7135000, 0.0367000], | ||
[0.0389000, -0.0685000, 1.0296000] | ||
] | ||
|
||
const von_kries = [ | ||
[0.4002400, 0.7076000, -0.0808100], | ||
[-0.2263000, 1.1653200, 0.0457000], | ||
[0.0000000, 0.0000000, 0.9182200] | ||
] | ||
|
||
const cat02 = [ | ||
[0.7328000, 0.4296000, -0.1624000], | ||
[-0.7036000, 1.6975000, 0.0061000], | ||
[0.0030000, 0.0136000, 0.9834000] | ||
] | ||
|
||
const cat16 = [ | ||
[ 0.401288, 0.650173, -0.051461 ], | ||
[ -0.250268, 1.204414, 0.045854 ], | ||
[ -0.002079, 0.048952, 0.953127 ] | ||
] | ||
|
||
console.log('===== bradford =====') | ||
console.log(bradford) | ||
console.log('===== bradford inverse =====') | ||
console.log(math.inv(bradford)) | ||
|
||
console.log('===== von kries =====') | ||
console.log(von_kries) | ||
console.log('===== von kries inverse =====') | ||
console.log(math.inv(von_kries)) | ||
|
||
console.log('===== cat02 =====') | ||
console.log(cat02) | ||
console.log('===== cat02 inverse =====') | ||
console.log(math.inv(cat02)) | ||
|
||
console.log('===== cat16 =====') | ||
console.log(cat16) | ||
console.log('===== cat16 inverse =====') | ||
console.log(math.inv(cat16)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are very different values.
The other changes seem to be the same value at higher precision, but this one is completely different.
Is this correct?
When we use these values in
postcss-preset-env
it dramatically changes the color results.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@romainmenke great catch! Accidentally copied in the adapted M cone response as the inverse. I have a fix here: #360. This one copies the correct matrix, directly calculated by color.js when a D50 <-> D65 conversion occurs.