Skip to content

Fix luma → cmyk conversion - #2661

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

reknih merged 1 commit into
typst:mainfrom
frozolotl:fix-cmyk

Conversation

@frozolotl

Copy link
Copy Markdown
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

Dherse commented Nov 11, 2023

Copy link
Copy Markdown
Contributor

I think @reknih should check this for sure.

@reknih

reknih commented Nov 13, 2023

Copy link
Copy Markdown
Member

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

reknih commented Nov 13, 2023

Copy link
Copy Markdown
Member

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
Copy Markdown
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

Dherse commented Nov 14, 2023

Copy link
Copy Markdown
Contributor

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