Skip to content

Fix luma → cmyk conversion#2661

Merged
reknih merged 1 commit intotypst:mainfrom
frozolotl:fix-cmyk
Nov 13, 2023
Merged

Fix luma → cmyk conversion#2661
reknih merged 1 commit intotypst:mainfrom
frozolotl:fix-cmyk

Conversation

@frozolotl
Copy link
Contributor

Previously, the luma → cmyk conversion produced incorrect results.
This new conversion matches the values gained from luma → rgba → cmyk.

This PR also fixes a bug where repr(luma(0%)) printed rgb(0%, 0%, 0%, 0%).

@Dherse
Copy link
Contributor

Dherse commented Nov 11, 2023

I think @reknih should check this for sure.

@reknih
Copy link
Member

reknih commented Nov 13, 2023

Nice!

@reknih reknih merged commit 6851098 into typst:main Nov 13, 2023
reknih added a commit that referenced this pull request Nov 13, 2023
@reknih
Copy link
Member

reknih commented Nov 13, 2023

Okay, I'm very sorry, I read the diff in reverse. We actually intentionally produce a mix of pigments for grays here such that full black becomes very rich black (sometimes called Photoshop black) instead of dark gray. Most likely, RGB to CMYK conversion should be fixed instead to align with this behavior. More on this here: https://www.bittbox.com/culture/photoshop-101-true-black-cmyk

We removed this commit from main. Sorry for the confusion.

@frozolotl frozolotl deleted the fix-cmyk branch November 13, 2023 11:15
@frozolotl
Copy link
Contributor Author

Oh, that makes sense; I'll probably check later today on how this can be solved without introducing problems like these.

@frozolotl frozolotl mentioned this pull request Nov 14, 2023
frozolotl added a commit to frozolotl/typst that referenced this pull request Nov 14, 2023
In typst#2661, I fixed the issue where `repr(cmyk(…))` printed `rgb(…)`.
However it was reverted due to issues with the other half of the PR in 33e2217.
This PR implements that fix again.
@Dherse
Copy link
Contributor

Dherse commented Nov 14, 2023

Okay, I'm very sorry, I read the diff in reverse. We actually intentionally produce a mix of pigments for grays here such that full black becomes very rich black (sometimes called Photoshop black) instead of dark gray.

I knew this code predated #2171 and that there was a good reason for it but I couldn't remember it.

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.

3 participants