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 extracting color from image #301

Open
Fox333-Lab opened this issue Apr 13, 2024 · 2 comments
Open

Error extracting color from image #301

Fox333-Lab opened this issue Apr 13, 2024 · 2 comments

Comments

@Fox333-Lab
Copy link

Hi, i am getting the below issue when trying extract colors from image

image

below is line of code causing the issue:

let file = e.target.files[0];
const reader = new FileReader();

reader.readAsDataURL(file);
reader.onload = (e: any) => {
setImage(e.target.result);
};

const palette = Palette.extract(image);  /* this line is causing the issue */

Note: Using NextjJS 14.1.2

Thank you in advance

@n-ce
Copy link

n-ce commented Jun 9, 2024

❯ Supports multiple image sources (`HTMLImageElement`, `HTMLCanvasElement`, `ImageData`)<br>

It does not support image url.

@ginestah
Copy link
Contributor

Hi, i am getting the below issue when trying extract colors from image

image

below is line of code causing the issue:

let file = e.target.files[0];
const reader = new FileReader();

reader.readAsDataURL(file);
reader.onload = (e: any) => {
setImage(e.target.result);
};

const palette = Palette.extract(image);  /* this line is causing the issue */

Note: Using NextjJS 14.1.2

Thank you in advance

You should be able to convert it by first creating an html img element with the image url as the src.

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