3 ms·
Here's a library called PNG Compressor that does this in the browser. Demo: https://eliot-akira.github.io/png-compressor/ https://eliot-akira.github.io/png-com
by lioeters 3y ago
Here's a library called PNG Compressor that does this in the browser.
Demo: https://eliot-akira.github.io/png-compressor/ https://eliot-akira.github.io/png-compressor/
It handles text as well as binary data.
- jdthedisciple 3y agoAre you sure it works? The image isnt loading for me.
- lioeters 3y agoOops, that figures, just when I made the URL public. I'll look into it. It was previously using canvas element to encode to PNG, but it turned out to be unreliable due to some browsers restricting canvas. I replaced the encoder, but maybe I forgot to build and deploy the demo page.
- lioeters 3y agoAh, I figured out the problem. The image was not showing on Chrome/ium due to `URL.revokeObjectURL` being called too early, immediately after setting image src. It needed to be called after the image finished loading. Does that solve it on your side?
- jdthedisciple 3y agoYep, now it works. Thank you.
- lioeters 3y agoThanks for pointing out the issue. :)