Open alexeyr-ci opened 9 months ago
That is true. I am currently working on a big PR, so I could add that as an option... What would you think the API should look like? I can think of three reasonable options:
getColor
to getColor( img: HMTLImageElement | HTMLCanvaasElement, [other options] )
img
argument optional and add canvas
optional argument. One would have to be supplied (this would be a breaking change, as that argument shouldn't be added to the end, which is not ideal)getColorCanvas( canvas: CanvasImage, [other options] )
getColor( img: HTMLImageElement )
which would call getColorCanvas@alexeyr-ci
I think 1 is clear enough, 3 is reasonable if you want to avoid 1.
In my use-case I already have a
Canvas
and want to find its dominant colors. It doesn't make much sense to convert it to an image and then draw that image on a canvas.