material-foundation / material-color-utilities

Color libraries for Material You
Apache License 2.0
1.57k stars 134 forks source link

Use web worker for Quantize and Score steps #129

Open FluorescentHallucinogen opened 6 months ago

FluorescentHallucinogen commented 6 months ago

This pull request moves the extraction of the dominant colors of the image to web worker to avoid heavy work (especially for high resolution images) on the main thread, improving the UI responsiveness. It also use OffscreenCanvas to convert the image to pixel array.

It uses feature-detect for Web Workers and OffscreenCanvas support, and if available, use them.

FluorescentHallucinogen commented 6 months ago

See also #133 and #128 for further possible performance optimizations.

FluorescentHallucinogen commented 6 months ago

@rodydavis @guidezpl Could you please take a look? 😉

guidezpl commented 6 months ago

Hi, I'm not working on this project now, please tag @pennzht @marshallworks instead :)