Mawi137 / ngx-image-cropper

An image cropper for Angular
MIT License
788 stars 209 forks source link

[Feature Request] Web Worker support #661

Open endlacer opened 1 week ago

endlacer commented 1 week ago

Hello all (and @Mawi137) just a quick question. Is it possible to add Web Worker support? I could try it myself but before I start implementing anything, I thought I ask if it is even wanted/doable.

Do you see any problems with it? I think I would start by adding a opt-in option to use webworkers, sounds good?

Mawi137 commented 1 week ago

Hi there

Sound like a very good idea. The operations on the canvas are quite heavy so it would indeed be nice to offload that to a worker. I have no idea if that's possible or whether there are limitations though.

Mawi137 commented 1 week ago

Just had a quick chat with ChatGPT and it seems like a worker cannot load the images itself, but by using OffscreenCanvas, it should be able to draw it on a canvas and then return the result of toBlob.