Tech
canvas.convertToBlob() doesn't throw on a format it can't encode. It hands you a PNG.
I've been building a set of file tools that run entirely client-side β no upload, no server. The image side turned out to need no library and no WASM binary at all . The browser already ships JPEG, PNG and WebP codecs, and shipping your own would cost megabytes to do it worse.
Here's the whole thing:
const bitmap = await createImageBitmap ( file )
const canvas = new OffscreenCanvas ( bitmap . width , bitmap . height )
const ctx = canvas . get...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to