Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions pages/common/svg2png.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# svg2png

> Render an SVG image to a PNG image using cairo.
> More information: <http://cairographics.org/>.
- Convert an SVG file to PNG:

`svg2png {{path/to/file.svg}} {{path/to/output.png}}`

- Convert an SVG file to PNG with a specific width (preserving aspect ratio):

`svg2png --width {{800}} {{path/to/file.svg}} {{path/to/output.png}}`

- Convert an SVG file to PNG with a specific height (preserving aspect ratio):

`svg2png --height {{600}} {{path/to/file.svg}} {{path/to/output.png}}`

- Convert an SVG file to PNG with both width and height (image centered in space):

`svg2png --width {{800}} --height {{600}} {{path/to/file.svg}} {{path/to/output.png}}`

- Convert an SVG file to PNG scaled by a factor:

`svg2png --scale {{2.0}} {{path/to/file.svg}} {{path/to/output.png}}`

- Convert an SVG from stdin to PNG on stdout:

`cat {{path/to/file.svg}} | svg2png - - > {{path/to/output.png}}`

- Flip the output image horizontally or vertically:

`svg2png --flipx {{path/to/file.svg}} {{path/to/output.png}}`