photopea / UPNG.js

Fast and advanced PNG (APNG) decoder and encoder (lossy / lossless)
MIT License
2.1k stars 259 forks source link

PNG Encoded ArrayBuffer back to IMG tag #67

Open mikeptweet opened 3 years ago

mikeptweet commented 3 years ago

So how does one get from the encoded contents ...

var png = UPNG.encode([dta.buffer], 200, 300, 0);

back to image data (or data url) that can be used in as the source in an element?

photopea commented 3 years ago

Maybe this could help you (line 14 to 17) ? https://gist.github.com/candycode/f18ae1767b2b0aba568e