Match content bbox not just canvas size
Re-rendering an SVG into a PNG variant that needed to visually match an existing reference PNG.
When matching an existing PNG asset, equal canvas dimensions are not enough — the reference may have been trimmed and re-padded after render, so its content bounding box (the non-transparent region) can occupy a very different fraction of the canvas than what the source SVFs viewBox/padding produces. Always run magick identify -trimon both files: it prints content WxH and offset like1842x1686 2048x2048+106+183. To match: render at high density, -trim +repage, -resizeto the reference content WxH, then-extentwith negative-gravity northwest` offsets equal to the reference offsets to re-pad to the target canvas.
Before rendering a variant, run magick identify -trim on the reference PNG to extract content size and offset, and treat those — not the canvas size — as the targets to match.