SVG string and PNG export examples

The compass sample is manually authored SVG from SVG AI's developer tutorials.
Use these examples with trusted, static, self-contained SVG, not arbitrary uploads.

Browser
1. Open browser-example.html in a current browser. It contains its own script.
2. Choose Preview SVG to display the string without changing its format.
3. Choose Convert to PNG, inspect the preview, then choose Download PNG.
4. Try invalid XML exercises the error state. Load example restores the sample.
The svg-to-png.js and display-svg.js files contain the reusable functions.

Node.js
1. Install a supported Node.js release.
2. In this folder, run npm init -y, then npm install sharp@0.34.5.
   On Windows PowerShell, use npm.cmd if your npm wrapper is blocked.
3. Run one of these commands with a new output filename:
   node render-string.cjs sample.svg my-compass.png png 720
   node render-string.cjs sample.svg my-compass.jpg jpeg 720
   node render-string.cjs sample.svg my-compass.webp webp 720
The command refuses to overwrite an existing file. PNG and WebP retain sample
transparency; the JPEG branch fills the background white.
The Node.js output must fit within 4096 pixels per side and 16 million pixels.
If the requested width cannot fit while preserving the image ratio, the script
asks for a smaller width instead of silently returning a narrower image.

Included output files
sample-720.png, sample-720.jpg and sample-720.webp were rendered with the supplied
Node.js script, Node.js 22.9.0 and Sharp 0.34.5 on Windows. Each is 720 by 480 pixels.
They are sample outputs, not a comparative benchmark. Browsers and other renderers
can produce different antialiasing and bytes.

Tutorials
https://www.svgai.org/blog/svg-to-png-javascript
https://www.svgai.org/blog/convert-svg-string-to-image
