Skip to content
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

Converting an image to CMYK: unsupported number of components: 4 #572

Open
steelzeh opened this issue Sep 28, 2021 · 1 comment
Open

Converting an image to CMYK: unsupported number of components: 4 #572

steelzeh opened this issue Sep 28, 2021 · 1 comment

Comments

@steelzeh
Copy link

I'm trying to convert a RGB image to CMYK, but i get an error that says: unsupported number of components: 4

When i run this part of the code

  console.log('Width', image.width);
  console.log('Height', image.height);
  console.log('colorModel', image.colorModel);
  console.log('components', image.components);
  console.log('alpha', image.alpha);
  console.log('channels', image.channels);
  console.log('bitDepth', image.bitDepth);

I get this in the console log, and it says components 3:

Width 458
Height 354
colorModel RGB
components 3
alpha 1
channels 4
bitDepth 8

But when i try to do this, it get the error unsupported number of components: 4
var cmykImage = image.cmyk();

Am i doing something wrong? Can't seem to find anything documenting this.

@lpatiny
Copy link
Member

lpatiny commented Oct 6, 2021

Could you give us the full code ?

Here is the testcase we have:

let image = new Image(2, 1, [100, 100, 0, 0, 100, 100], { kind: 'RGB' });
let newImage = image.cmyk();
expect(newImage.colorModel).toBe('CMYK');
expect(newImage.bitDepth).toBe(8);
expect(Array.from(newImage.data)).toStrictEqual([
0, 0, 255, 155, 255, 0, 0, 155,

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

No branches or pull requests

2 participants