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] Image serving using wasm-image-optimization wasm package #153

Open
2 tasks done
kumardeo opened this issue Dec 6, 2024 · 0 comments
Open
2 tasks done
Labels

Comments

@kumardeo
Copy link

kumardeo commented Dec 6, 2024

Is your feature request related to a problem?

Currently, we cannot use <Image> component without depending on image services (Cloudflare images, etc).

Describe the solution you'd like

Using wasm-image-optimization, we can optimize (resize, convert to other formats i.e. webp) images which will be similar to what Next.js does using Sharp. We can simply do this by replacing Next.js' internal api endpoint /_next/image with our custom api with same behaviour using wasm-image-optimization (as an alternative to Sharp).

Describe alternatives you've considered

I am currently using service bindings to achieve this.
First thing to note that the size of latest version of wasm-image-optimization (v1.1.2, when I am writing this) is too large (~5026.63 KiB / gzip: ~1575.80 KiB), therefore we need to use v1.0.4 (since it is lightweight (~2470.85 KiB / gzip: ~771.76 KiB) and contains everything we need except for avif format output) to make sure we can deploy apps with image serving on Workers free plan.
Second thing to note that when I was using it, It was not able to transform large images. I guess this is because of Cloudflare Worker's memory limit. So, we need to handle this as well.

@opennextjs/cloudflare version

0.2.1

Additional context

No response

Before submitting

  • I have checked that there isn't already a similar feature request
  • This is a single feature (not multiple features in one request)
@kumardeo kumardeo added enhancement New feature or request triage labels Dec 6, 2024
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

2 participants