2011-10-15 37 views
5

我有许多多边形的SVG:作物和规模SVG到使用ImageMagick PNG,无像素化

https://github.com/barrycarter/bcapps/blob/master/sample-data/current-temps.svg

,看起来有点像这样:

enter image description here

裁剪这一点,并转换到PNG工作正常:

convert -crop 100x100+200+150 current-temps.svg /tmp/exhb2.png 

enter image description here

裁剪和缩放,但是,失败:

convert -crop 100x100+200+150 -scale 1000x750 current-temps.svg /tmp/exhb3.png 

enter image description here

如何让ImageMagick的裁剪之前 “放大到” 的SVG?

(我知道ImageMagick的只能读,不能写的SVG格式,但 应该还是能够做到我想要什么?)

编辑/解决:

谢谢,robermorales。

inkscape -z -e out4.png -w 1000 -h 1000 -a 200:200:400:400 current-temps.svg 

(例如)像魅力一样工作。

我还认识到复制SVG,调整变换线:

<g transform="scale(3,3) rotate(-90) translate(-90,180)"> 

,然后转换为PNG是另一种解决方案。

回答

6

尝试在裁剪前进行缩放。

但是,使用inkscape cli这样做更容易。

对不起,没有链接,afk

0

正确的ImageMagick语法在这里是读取输入,然后裁剪,然后调整大小。请参阅http://www.imagemagick.org/Usage/basics/#why尽管这不太可能是问题所在。问题在于 - 比例将复制像素,因此使它块。您应该用-resize替换-scale。这会更平滑,但对于您要求的放大倍数模糊不清。试试这个命令:

convert current-temps.svg -crop 100x100+200+150 -resize 1000x750 exhb3.png