
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
@nowline/export-png
Advanced tools
Rasterizes a Nowline-rendered SVG to PNG using
@resvg/resvg-js (a Rust→WASM SVG
rasterizer). Bundled into the nowline CLI.
License: Apache 2.0
Part of: lolay/nowline monorepo
Spec: specs/handoffs/m2c.md § 3
pnpm add @nowline/export-png @nowline/export-core @nowline/renderer
import { layoutRoadmap } from '@nowline/layout';
import { renderSvg } from '@nowline/renderer';
import { resolveFonts } from '@nowline/export-core';
import { exportPng } from '@nowline/export-png';
const svg = await renderSvg(layoutRoadmap(file, resolved, { theme }));
const fonts = (await resolveFonts({ headless: true })).pair();
const png = await exportPng({ ast, resolved, model, sourcePath, today }, svg, {
scale: 2,
fonts,
});
// `png` is a Uint8Array of PNG bytes.
| Option | Default | Notes |
|---|---|---|
scale | 2 | Pixel-density multiplier. Scales the root <svg width/height> before rasterization. Common values: 1, 1.5, 2, 3. |
background | model | Override the background color (CSS color or transparent). |
fonts | resolveFonts() | Pre-resolved sans/mono pair. If omitted, the exporter calls @nowline/export-core's resolver itself. |
resvgOptions | (none) | Escape hatch for resvg-js options. Use sparingly. |
The scale factor is applied by rewriting the root SVG element's
width/height attributes — resvg-js 2.6.x ignores fitTo when
fontBuffers is set, so this is the workaround the package uses to keep
custom-font rendering deterministic.
_resetResvgModule() test seam clears the cache.loadSystemFonts: false — only fonts passed via fontBuffers are
visible to resvg, so identical input produces identical bytes regardless
of host machine.@nowline/export-core's 5-step resolver. With
--headless (or the equivalent option here), the bundled DejaVu pair is
used and the output is byte-stable across macOS / Linux / Windows.\x89PNG\r\n\x1a\n followed by an IHDR chunk
whose dimensions equal scale × <svg width> × scale × <svg height>.Snapshots live in test/__snapshots__/. Regenerate with vitest -u. Hash
tests in test/export-png.test.ts confirm byte-stability across
re-renders.
Apache-2.0.
FAQs
Exports a Nowline roadmap as a PNG image.
We found that @nowline/export-png demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.