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

Error: Malformed data passed to binarizer. #237

Open
jarawin opened this issue May 9, 2023 · 2 comments
Open

Error: Malformed data passed to binarizer. #237

jarawin opened this issue May 9, 2023 · 2 comments

Comments

@jarawin
Copy link

jarawin commented May 9, 2023

No description provided.

@crapthings
Copy link

same here, what is wrong?

@LaserKaspar
Copy link

LaserKaspar commented Oct 27, 2023

You need to provide more detail. This error usually comes up when the passed in image data has something other than 4 channels.
This can either be fixed by converting your input to rgba:

for (let i = 0; i < rgbArray.length; i += 3) {
  rgbaArray[i] = rgbArray[i];
  rgbaArray[i + 1] = rgbArray[i + 1];
  rgbaArray[i + 2] = rgbArray[i + 2];
  rgbaArray[i + 3] = 255; // Alpha channel set to 255 (fully opaque)
}

or by editing the source to understand rgb <- Way more efficient, but would need to be done by a maintainer of the reop.

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

3 participants