Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Web Worker support #661

Open
endlacer opened this issue Nov 25, 2024 · 4 comments
Open

[Feature Request] Web Worker support #661

endlacer opened this issue Nov 25, 2024 · 4 comments

Comments

@endlacer
Copy link

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
Copy link
Owner

Mawi137 commented Nov 26, 2024

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
Copy link
Owner

Mawi137 commented Nov 26, 2024

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.

@endlacer
Copy link
Author

endlacer commented Dec 5, 2024

I tried a bit but had problems with creating a webworker in the angular lib. Angular did not bundle the worker into dist and I had trouble doing it manually, so i gave up.
creating a web worker via angular cli does not work: see angular/angular-cli#15059

Also tried using OffscreenCanvas, but that did not have any impact on cropping/rotating speed..

@Mawi137
Copy link
Owner

Mawi137 commented Dec 5, 2024

Ok too bad. I think the only thing to gain from using a web worker is not blocking the UI.
Maybe WebAssembly is a solution to speed up the cropping.
Anyway, thanks for trying!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants