Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ This package also ships a pure WebAssembly artifact built with `wasm-bindgen` to
const resvgJS = new resvg.Resvg(svg, opts)
const pngData = resvgJS.render(svg, opts) // Output PNG data, Uint8Array
const pngBuffer = pngData.asPng()
pngData.free() // Free memory
resvgJS.free()
const svgURL = URL.createObjectURL(new Blob([pngData], { type: 'image/png' }))
document.getElementById('output').src = svgURL
})()
Expand Down
3 changes: 3 additions & 0 deletions wasm/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@
const pngData = resvgJS.render()
const pngBuffer = pngData.asPng()

pngData.free()
resvgJS.free()

document.querySelector('#output img').src = URL.createObjectURL(
new Blob([pngBuffer], { type: 'image/png' })
)
Expand Down