10.8 PNG: dpi, physical size and pixel limits
nlmx rasterizes publication SVG with its built-in SVG renderer. It does not require a system browser or system SVG library for this conversion. The embedded Liberation Sans Regular and Bold fonts make the raster path more controlled than depending on whichever fonts happen to be installed.
Points to pixels
The SVG is interpreted in points and rasterized with scale dpi / 72. For a 144×72-point figure at 300 dpi, the result is 600×300 pixels:
After encoding, nlmx inserts a PNG pHYs chunk. Its pixels-per-metre value is round(dpi / 0.0254); at 300 dpi this is 11,811 pixels per metre. Software that honors pHYs can place the image at the intended physical dimensions rather than guessing from pixel count.
Physical size versus density
The same 7×5-inch design becomes 1050×750 pixels at 150 dpi, 2100×1500 at 300 dpi and 4200×3000 at 600 dpi. Axis locations and font size in inches are intended to remain the same. Doubling dpi does not make labels twice as large on the page; it samples them more densely.
| Width × height | DPI | Pixel dimensions | Pixel area |
|---|---|---|---|
| 7 × 5 in | 150 | 1050 × 750 | 0.79 million |
| 7 × 5 in | 300 | 2100 × 1500 | 3.15 million |
| 7 × 5 in | 600 | 4200 × 3000 | 12.60 million |
| 17.78 × 12.7 cm | 300 | 2100 × 1500 | 3.15 million |
Safety limit
Rasterization refuses images whose width times height exceeds 400,000,000 pixels. The error recommends reducing size or dpi. This guard limits memory use, but it is not a publication-quality recommendation: a file far below the cap can still be unnecessarily large, and a small file can still be too low-resolution for its use.
The accepted dpi range in shared plot settings is 50 through 2400; the base-font range is 4 through 48 points. Passing validation means the setting is permitted, not that it is readable or appropriate.
Inspecting a PNG
QC should read the IHDR pixel dimensions and pHYs metadata, then place the figure at its intended size in the actual document workflow. Some editors ignore or rewrite resolution metadata. If an editor reports a surprising physical size, calculate inches from pixels/dpi rather than resampling blindly.
Common mistakes
- Changing dpi when the real requirement is a different physical width.
- Upscaling a low-resolution screenshot and calling it 300 dpi.
- Assuming every office application honors
pHYs. - Selecting extreme dpi because it passes input validation.
Checklist
- Set physical dimensions first and dpi second.
- Verify IHDR dimensions and
pHYsmetadata. - Inspect the image at final placement size.
- Retain SVG when future resizing or editing is likely.
Further reading
See the figure pipeline, SVG preservation and publication QC.