path png转svg_macOS下将svg转为png

macOS下如何将.svg格式的图片转为.png、.jpg等常用格式呢?

方案很多,这里介绍librsvg。

安装librsvg

brew install librsvg

完成后查看版本:

rsvg-convert --version

svg转png

一行命令搞定:

// 命令格式

rsvg-convert >

// 举个栗子(有很多参数可配置)

rsvg-convert -d 90 -p 90 -w 360 -h 360 jklogo.svg > jklogo.png

librsvg帮助

ypfdeMBP15:临时图片 ypf$ rsvg-convert --help

用法:

rsvg-convert [选项…] [FILE...] - SVG Converter

帮助选项:

-?, --help 显示帮助选项

应用程序选项:

-d, --dpi-x= pixels per inch [optional; defaults to 90dpi]

-p, --dpi-y= pixels per inch [optional; defaults to 90dpi]

-x, --x-zoom= x zoom factor [optional; defaults to 1.0]

-y, --y-zoom= y zoom factor [optional; defaults to 1.0]

-z, --zoom= zoom factor [optional; defaults to 1.0]

-w, --width= width [optional; defaults to the SVG's width]

-h, --height= height [optional; defaults to the SVG's height]

-f, --format=[png, pdf, ps, eps, svg, xml, recording] save format [optional; defaults to 'png']

-o, --output output filename [optional; defaults to stdout]

-i, --export-id= SVG id of object to export [optional; defaults to exporting all objects]

-a, --keep-aspect-ratio whether to preserve the aspect ratio [optional; defaults to FALSE]

-b, --background-color=[black, white, #abccee, #aaa...] set the background color [optional; defaults to None]

-s, --stylesheet Filename of CSS stylesheet

-u, --unlimited Allow huge SVG files

--keep-image-data Keep image data

--no-keep-image-data Don't keep image data

-v, --version show version information

ypfdeMBP15:临时图片 ypf$

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值