google / brunsli

Practical JPEG Repacker
MIT License
730 stars 51 forks source link

Compressing in browser preupload #67

Closed Charuru closed 4 years ago

Charuru commented 4 years ago

Can we have some instructions on how to setup wasm to do this please?

eustas commented 4 years ago

Hello. You could check https://brunsli.dev/test.html On this page ServiceWorker upgrades the HTTP request so that nginx plugin sends compressed file instead of original. When response arrives, ServiceWorker decodes it and passes as JPEG to browser.

Using up WASM is usually simple:

Please refine the question, if I got it wrong.

Charuru commented 4 years ago

Thanks, the question was about how to upload a compressed file with image data from canvas instead of compressing on the server.

eustas commented 4 years ago

With current API it could be done in 2 steps: