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

WebAssembly / CloudFlare workers support #2863

Closed
antony opened this issue Aug 27, 2021 · 9 comments
Closed

WebAssembly / CloudFlare workers support #2863

antony opened this issue Aug 27, 2021 · 9 comments
Labels

Comments

@antony
Copy link

antony commented Aug 27, 2021

What are you trying to achieve?

We'd love to deploy this on CloudFlare workers. As of early this year, libvips is now compiled for that target, so as I understand it, the remaining step is to compile sharp as WebAssembly.

Libvips issue is here libvips/libvips#192

Have you searched for similar feature requests?

Yes - There is #1476 but it was closed and locked prior to the libvips changes.

What would you expect the API to look like?

I'm not at all familiar with WebAssembly, I'm afraid.

What alternatives have you considered?

Not using cloudflare workers

@lovell
Copy link
Owner

lovell commented Aug 27, 2021

Please see kleisauke/wasm-vips#2

@okikio
Copy link

okikio commented Dec 28, 2021

wasm-vips is now a thing, so, is it possible to have a wasm version of sharp?

@eli-front
Copy link

Any updates here?

@hadnet
Copy link

hadnet commented Jun 14, 2023

It would be great if this package could work on CFW.

@nilansaha
Copy link

Nothing yet it seems. I coded up an image processing tool and then realized this does not work in Cloudflare workers

@peterhirn
Copy link

peterhirn commented Oct 22, 2023

wasm-vips is now a thing, so, is it possible to have a wasm version of sharp?

Unfortunately wasm-vips will not be able to run on Cloudflare in the foreseeable future, see kleisauke/wasm-vips#2 (comment)

Alternatives

@lovell
Copy link
Owner

lovell commented Nov 19, 2023

Experimental support for WebAssembly environments will be arriving in v0.33.0 - please see #3336 - however Cloudflare Workers does not currently support threading or the Web Workers API so you'll need to ask Cloudflare about this lack of support if you need to use their services.

@ThatGuySam
Copy link

ThatGuySam commented Nov 25, 2023

Experimental support for WebAssembly environments will be arriving in v0.33.0 - please see #3336 - however Cloudflare Workers does not currently support threading or the Web Workers API so you'll need to ask Cloudflare about this lack of support if you need to use their services.

@lovell Is there any kind of Single-Threaded mode for Sharp?

Even a dramatically slower option could still be useful for processing ultra-small images such as 100x100 thumbnails, Favicons, 50x50 Profile Pictures, etc...

@lovell
Copy link
Owner

lovell commented Nov 26, 2023

@ThatGuySam Threading is fairly fundamental to libvips as well as an increasing number of the dependencies it relies on for image codecs. From what I can tell, Cloudflare Workers appears to be more suitable for tasks that are I/O bound rather than CPU bound. If performance isn't of concern then perhaps try jimp.

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

No branches or pull requests

8 participants