Rendering

Render symbols as vector graphics, PNG files or RGBA pixel buffers. The output uses square modules and a quiet zone.

SVG

typescript
const svg = qr.renderSvg(symbol, {
  foreground: [24, 32, 20],
  background: [255, 255, 255],
});

PNG

typescript
const png = qr.renderPng(symbol, { scale: 8 });

PNG scale is measured in pixels per module. The default quiet zone is four modules for QR Code and two for Micro QR.

Raster

Use renderRaster when you need an RGBA buffer for your own image pipeline.

Encoding options