This is a live example of how to get rasterized SVG in WebWorker without blocking the main thread:

  1. In the main thread, we create a new MessageChannel
  2. Then, in the same main thread, we create a web worker and an Iframe and forward the MessageChannel ports (part1 and part2) to them.
  3. WebWorker passes the necessary data to an Iframe, in which the SVG is converted to a raster and sent as an ImageBitmap back to WebWorker.

For clarity, the rasterized image is passed to the main thread and displayed on the canvas

Read more in this article (original lang = rus, use a translator)

See result (below it should be a canvas with a smiley face):