Skip to content

Commit d4e8d26

Browse files
hwbehrensManagorivanbaluta
authored
svg2png: add page (#19541)
Co-authored-by: Managor <[email protected]> Co-authored-by: Ivan Baluta <[email protected]>
1 parent 244ad2d commit d4e8d26

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

pages/common/svg2png.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# svg2png
2+
3+
> Render an SVG image to a PNG image using cairo.
4+
> More information: <https://cairographics.org/>.
5+
6+
- Convert an SVG file to PNG:
7+
8+
`svg2png {{path/to/file.svg}} {{path/to/output.png}}`
9+
10+
- Convert an SVG file to PNG with a specific width (preserving aspect ratio):
11+
12+
`svg2png {{[-w|--width]}} {{800}} {{path/to/file.svg}} {{path/to/output.png}}`
13+
14+
- Convert an SVG file to PNG with a specific height (preserving aspect ratio):
15+
16+
`svg2png {{[-h|--height]}} {{600}} {{path/to/file.svg}} {{path/to/output.png}}`
17+
18+
- Convert an SVG file to PNG with both width and height (image centered in space):
19+
20+
`svg2png {{[-w|--width]}} {{800}} {{[-h|--height]}} {{600}} {{path/to/file.svg}} {{path/to/output.png}}`
21+
22+
- Convert an SVG file to PNG scaled by a factor:
23+
24+
`svg2png {{[-s|--scale]}} {{2.0}} {{path/to/file.svg}} {{path/to/output.png}}`
25+
26+
- Convert an SVG from `stdin` to PNG on `stdout`:
27+
28+
`cat {{path/to/file.svg}} | svg2png - - > {{path/to/output.png}}`
29+
30+
- Flip the output image horizontally or vertically:
31+
32+
`svg2png --flipx {{path/to/file.svg}} {{path/to/output.png}}`

0 commit comments

Comments
 (0)