简体   繁体   中英

How to export svg image to png file in r?

I have some svg images that I want to export as png files, using r. Is there a function that can do that? Until now I only found function that export r plots to png.

But how could I export eg this example as a png?

<svg height="100" width="100">
  <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
</svg> 

rsvg https://github.com/jeroenooms/rsvg专门用于执行此操作,我会说它很快完成。

The package convertGraph may be the solution here. It claims to convert SVG to other image formats (PNG, JPG, etc.). It requires phantomjs for the conversion.

The convertGraph R package can convert graphical file formats within R and does not even require RStudio. So any SVG file can be exported to PNG, PDF, JPEG, GIF, ... and you also have control over the resolution of the exported image.

In addition, it can convert other file formats to one another (eg PNG to PDF, PNG to JPEG, GIF to PNG, etc...). The package is hosted on CRAN as well as GitHub .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM