this is a little demo on how to load images in a non-blocking way using webworker
what this program does:
- it loads a png image in a web worker, using the
fetch()
api. - it parses the data using the png.js library
- it passes the png data to the main thread using
postMessage()
- it draws the contents of the image on a canvas element
the important part for me was the fact that i can get the pixel data of the png without blocking the main thread…