svg - inkscape 命令行 svg 到 png - 设置宽度和 dpi

标签 svg inkscape

我想使用inkscape命令行工具将svg转换为png。尽管在 svg 中指定了什么,我想同时设置生成的 png 的宽度和要使用的 dpi。来自 inkscape docu这似乎是不可能的:

-w WIDTH, --export-width=WIDTH

The width of generated bitmap in pixels. This value overrides the --export-dpi setting (or the DPI hint if used with --export-use-hints).


我真的无法理解这是怎么回事,因为宽度和使用的 dpi 不应该直接相关。我怎样才能实现设置这两个值。
谢谢,马丁

最佳答案

好的,我想,就像我的具体例子一样:

在 svg 中,宽度为 2480 像素(DinA4 300 dpi 打印所需的)。现在我的错误是将“-d 300”添加到inkscape调用中,如果svg没有给出某个单位的宽度,这没有意义。这样做时,结果图像的宽度为 2480 * 300/90 = 8267 像素。因此,如果在 svg 中使用像素,您需要注意inkscape 将其解释为 90 dpi ...

好吧,我想这只是我的困惑,但很高兴分享;-)

关于svg - inkscape 命令行 svg 到 png - 设置宽度和 dpi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25121904/

相关文章:

javascript - 选择时 d3 堆栈条形图的边框

html - SVG 背景悬停时闪烁一次

javascript - 如何在 SVG 中获取有效的动态 javascript 引用

css - 如何在 CSS 中设置背景图像以使用已定义的 SVG 模式?

javascript - 用鼠标绘制 SVG

math - Inkscape .91 带 latex

javascript - paper.js 联合差异和交集

python - 在 Python 中调用 Inkscape

Matplotlib 多个散点图 - 减小 svg 文件大小

pdf - 批量将svg转换为pdf页面大小