如何将 svg 图像导出到 r 中的 png 文件?
How to export svg image to png file in r?
我有一些 svg 图像要使用 r 导出为 png 文件。有没有可以做到这一点的功能?到目前为止,我只找到了将 r 图导出到 png 的函数。
但是我怎么能导出例如这个例子作为png?
<svg height="100" width="100">
<circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
</svg>
用于转换的包 convertGraph
may be the solution here. It claims to convert SVG to other image formats (PNG, JPG, etc.). It requires phantomjs。
rsvg
https://github.com/jeroenooms/rsvg 专门设计用于执行此操作,我会说它执行得非常快。
convertGraph R package 可以在 R 中转换图形文件格式,甚至不需要 RStudio。因此,任何 SVG 文件都可以导出为 PNG、PDF、JPEG、GIF 等格式,而且您还可以控制导出图像的分辨率。
此外,它还可以将其他文件格式相互转换(例如 PNG 到 PDF、PNG 到 JPEG、GIF 到 PNG 等)。该软件包托管在 CRAN as well as GitHub 上。
我有一些 svg 图像要使用 r 导出为 png 文件。有没有可以做到这一点的功能?到目前为止,我只找到了将 r 图导出到 png 的函数。
但是我怎么能导出例如这个例子作为png?
<svg height="100" width="100">
<circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
</svg>
用于转换的包 convertGraph
may be the solution here. It claims to convert SVG to other image formats (PNG, JPG, etc.). It requires phantomjs。
rsvg
https://github.com/jeroenooms/rsvg 专门设计用于执行此操作,我会说它执行得非常快。
convertGraph R package 可以在 R 中转换图形文件格式,甚至不需要 RStudio。因此,任何 SVG 文件都可以导出为 PNG、PDF、JPEG、GIF 等格式,而且您还可以控制导出图像的分辨率。
此外,它还可以将其他文件格式相互转换(例如 PNG 到 PDF、PNG 到 JPEG、GIF 到 PNG 等)。该软件包托管在 CRAN as well as GitHub 上。