UNPKG

read-png

Version:

Universal PNG File Reader. Uses read-pixels in the Browser and pngjs in NodeJS

22 lines (21 loc) 629 B
<!DOCTYPE html> <html> <head> <script src="https://unpkg.com/read-png"></script> </head> <body style="background: yellow;"> <script> (async () => { try { const ab = await fetch("./test/flower.png").then(res => res.arrayBuffer()); await readPixels({ data: ab, debug: true }); await readPixels({ data: new Uint8Array(ab), debug: true }); document.body.style.background = "green"; } catch (error) { console.error(error); document.body.style.background = "red"; } })() </script> </body> </html>