Skip to content

Conversation

aki-cat
Copy link

@aki-cat aki-cat commented Sep 1, 2025

  • Made it using the same conversion the package already does for CMYK-8bit.
  • Fixed number of bytes per pixel returned for CMKY-8bit as well (not sure if that was intentional or not).

Tested with real files.

@@ -399,6 +408,18 @@ fn cmyk_to_rgb(cmyk: &[u8]) -> [u8; 3] {
]
}

fn cmyk_to_rgb16(cmyk: &[u16]) -> [u16; 3] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This "quick&dirty" method is fine for debugging or testing purposes, but it is unsuitable for production code.
CMYK is a subtractive color model that can represent multiple print colorspaces, and RGB is an additive color model that can represent multiple display colorspaces. You need to know both the RGB colorspace (e.g. sRGB, Adobe RGB) and the CMYK colorspace (e.g. US Web Coated SWOP v2) in order to properly convert between the two. Without that information, the conversion is mostly meaningless.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same function as a few lines above that. I do agree that this is an innaccurate conversion, but as it is now CMYK-8bit is being converted exactly like this. The question is whether this is a separate issue or included in this one.

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.

2 participants