Resize images before running quanitizer, like the real Palette does. #2
Comments
My past encounter with canvas seems to suggest that processing every pixels wouldn't be that bad, as long as you don't allocate tons of memories in the process. I just created a benchmark for
The gist is that quality 8 is only 1.48x faster than quality 1 (btw, quality = 0 will cause an infinite loop, which is in the document and should be corrected). That's hardly a significant dent in performance. Note that |
Thanks, I took the 'quality' stuff from ColorThief which stated that if you'd run it on 0 you'd get the highest quality. I'll correct it. |
I see. What I was trying to say is that you could just process the image at its original size and get consistent result right away and see if it's really worth the trouble of downsampling and stuff in browser environment. There're tons of canvas applications that process whole images without running into significant performance trouble. |
Fixed in node-vibrant |
Currently, the demo site is a pretty good example for this: if you change the size of your browser, the palette will change.
This is of course caused by the image size changing, and because of Vibrant not loading every single pixel (only the 5th, each time, by default, as configured by the quality parameter)
For more consistent results, Vibrant should resize the image to a default set max size before getting swatches from it.
Maybe even instead of grabbing every fifth pixel, it should grab every pixel when it's downscaled. (unless performance takes a hit)
Palette does this as well.
The text was updated successfully, but these errors were encountered: