← 返回命令列表

Linux command

svg2png 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Convert SVG to PNG

svg2png [input.svg] [output.png]

With specific width

svg2png -w [800] [input.svg] [output.png]

With specific height

svg2png -h [600] [input.svg] [output.png]

Scale factor

svg2png --scale [2] [input.svg] [output.png]

说明

svg2png converts SVG vector graphics files to PNG raster images. It rasterizes the scalable vector content at a specified resolution, producing pixel-based output suitable for web use, documentation, or any context requiring bitmap images. Output dimensions can be controlled by specifying width, height, or a scale factor relative to the original SVG viewport size. The background is transparent by default, preserving alpha channel information from the SVG source. Various implementations exist based on different rendering libraries such as librsvg or Node.js-based engines.

参数

-w _WIDTH_
Output width.
-h _HEIGHT_
Output height.
--scale _FACTOR_
Scale multiplier.
--background _COLOR_
Background color.
--help
Show help.

FAQ

What is the svg2png command used for?

svg2png converts SVG vector graphics files to PNG raster images. It rasterizes the scalable vector content at a specified resolution, producing pixel-based output suitable for web use, documentation, or any context requiring bitmap images. Output dimensions can be controlled by specifying width, height, or a scale factor relative to the original SVG viewport size. The background is transparent by default, preserving alpha channel information from the SVG source. Various implementations exist based on different rendering libraries such as librsvg or Node.js-based engines.

How do I run a basic svg2png example?

Run `svg2png [input.svg] [output.png]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -w _WIDTH_ do in svg2png?

Output width.