Hacker News new | ask | show | jobs
by DaleCurtis 177 days ago
FWIW, you can do this with a few lines of JS in the browser using canvas.drawImage() from an img element followed by canvas.toBlob().
2 comments

Firefox now adds random noise to all canvas readback operations (getImageData, toDataURL, and toBlob).
Ah, I didn't realize that always happened. I thought it was only if you did something that might have OS specific rendering characteristics (text-draws, etc).

Maybe having an ImageEncoder API might be worthwhile after all then https://github.com/w3c/webcodecs/issues/204.

That would require a browser that supports WebP
...which is, like, all of them released over the past 5 years: https://caniuse.com/webp