svg is a graphic format used to describe two-dimensional vector graphics. It has many advantages, but sometimes not all scenes support svg, so at this time, we need to convert svg images to png and other formats.
Of course, there are many ways to convert svg to png. For example, you can use online web tools, or you can use terminal commands. Here we mainly design the use of terminal commands for conversion processing.
svgexport tool
- svgexport is a NodeJs module and a command line tool.
- Can be converted from svg to png, jpeg and other formats.
- github address https://github.com/shakiba/svgexport
Installation is easy
1
|
|
How to use
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 twenty one twenty two twenty three twenty four 25 26 |
|
Conversion example
Scale up by 1.5x
1
|
|
Scaled proportionally, specifying a width of 32px
1
|
|
Set the width and height (32px:54px) for scaling
1
|
|
Set JPEG output quality
1
|
|
Batch conversion script
1 2 3 4 5 6 7 8 9 10 11 |
|
This article is reproduced from: https://droidyue.com/blog/2022/04/25/convert-svg-to-jpg-or-png-in-a-fast-way/
This site is for inclusion only, and the copyright belongs to the original author.