Convert SVG to PNG using R programming

Submitted by Dickens A S on Sun, 10/03/2021 - 08:39
cygwin tools
------------
make
curl

cygwin libraries
--------------
libfftw3-devel
libsndfile-devel
libuv-devel
libxml2-devel
librsvg2-devel
libMagick-devel
libtirpc-devel
libicu-devel
libpcre2-devel
libcurl-devel
libncurses-devel
libbz2-devel
zlib-devel
lzma-devel
libiconv-devel
gmp-devel
mpfr-devel
gettext-devel
gcc-core
gcc-g++

Then within cygwin terminal type "R" in the terminal it will give you a prompt and issue the below commands

install.packages("magick", repos='https://cran.rstudio.com')
install.packages("rsvg", repos='https://cran.rstudio.com')

Wait until gets completed, once it gets completed issue command q() then the R will close

Then use this code to convert any SVG to PNG

library(magick)
testimage <- image_read_svg('testimage.svg', width = 350)
image_write(testimage, path = "testimage.png", format = "png")

it will create new PNG file from the svg file

Finished!
 

Add new comment