lokesh / color-thief

Grab the color palette from an image using just Javascript. Works in the browser and in Node.
https://lokeshdhakar.com/projects/color-thief/
MIT License
12.67k stars 1.31k forks source link

Feature request: api for transparency detection #213

Open pklada opened 3 years ago

pklada commented 3 years ago

Firstly, I love this library and we use it throughout our product. That said, we often use the feature to add a background color to the "frame" of an image if it doesn't fit its bounds. In most cases, we want to disable this behavior and simply render a white background if the image has transparency as otherwise this can produce strange results.

Ideally, for performance reasons, we don't double sample the image to determine transparency and color. Would it make sense if color thief could returned something like hasTransparency with the color palette, or would you consider that out of the scope of this project? Thanks!

akhlopyk commented 3 years ago

Vote for this feature! I need it too.