Seamless image compression prior to upload with a hybrid approach:
Client primary: Squoosh (WASM)
Client fallback: Canvas API
Server safety net: Sharp
Defaults: max width $1920$px, max size $512$ KB, quality $75$ (adjust down to hit size).
采用混合方案实现上传前的无缝图片压缩:
客户端首选: Squoosh(WASM)
客户端降级方案: Canvas API
服务端安全保障: Sharp
默认配置: 最大宽度1920px,最大体积512 KB,画质75(可下调画质以满足体积限制)。
When to Use
适用场景
✅ Web apps that upload user images and must reduce bandwidth
✅ Need transparent UX (no user action)
✅ Want modern codecs but must support older browsers