VL.ColorThief

bonjour there,

made small VL wrapper around the ColorThief library that allows to get color palettes and dominant color out of an SKImage

image

To install, go to Gamma’s command-line and type

nuget install VL.ColorThief -pre

as always, source patch is here.

enjoy!

6 Likes

very nice, thanks.

it’s just a pity that the c# implementation differs from the js one. in my tests, it fails for the dominantcolor, where it makes an averagecolor instead of the most dominant one.
as a workaround, i sorted the palette output by popolation (orderbydescending) and used the first slice as dominant color. at least that comes close to the original js imp.

i used this for comparison: https://lokeshdhakar.com/projects/color-thief/

2 Likes

thanks for the feedback!

just pushed a new GetColor (Sorted) node that uses the algorithm you described, seems much more accurate in some cases indeed.

Jan 2020 update : thanks to @sebl, you can now also extract color palettes from files and bitmaps, instead of only SKImage.

2 Likes

Hey @sebescudie ,

i was wondering if this only works in vl with skimage? Is there an image or dx11texture example?
Its a really awesome plugin and would like to use it in vvvvland :)

yo!

it should work if you use AsImage to input the DX11 texture in vlllland, and then use FromImage (Bitmap) with the bitmap versions of the ColorThief nodes.

note there still seems to be a bug with ColorThief as described here, just tried on b39 here with no luck :(

there’s also an overload that works on images (has fromImage inside)
but also no idea if it works in b39 though