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

hope sharp.metadata provides a method to get the main color of the image #3228

Closed
apprat opened this issue May 16, 2022 · 3 comments
Closed
Labels

Comments

@apprat
Copy link

apprat commented May 16, 2022

Feature request

What are you trying to achieve?

Hope sharp.metadata provides a method to get the main color of the image

When you searched for similar feature requests, what did you find that might be related?

I can't find any related questions

What would you expect the API to look like?

metadata.getPrimaryColor() => {r: number, g: number, b: number}

What alternatives have you considered?

No

@apprat
Copy link
Author

apprat commented May 16, 2022

I don't know how to describe how this main color is composed, however, many apps will display the main color of the image as a placeholder when loading an image.

@lovell
Copy link
Owner

lovell commented May 17, 2022

Did you see the dominant property of stats()? https://sharp.pixelplumbing.com/api-input#stats

const { dominant } = await sharp(input).stats()

@lovell
Copy link
Owner

lovell commented Jun 8, 2022

I hope this information helped. Please feel free to re-open with more details if further assistance is required.

@lovell lovell closed this as completed Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants