Learn R Programming

convertGraph (version 0.1)

convertGraph: Convert Graphical Files Format

Description

Converts graphical file formats (SVG, PNG, JPEG, BMP, GIF, PDF, etc) to one another. The exceptions are the SVG file format that can only be converted to other formats and in contrast, PDF format, which can only be created from others graphical formats. The main purpose of the package was to provide a solution for converting SVG file format to PNG which is often needed for exporting graphical files produced by R widgets.

Usage

convertGraph(from, to, size = 1.0, path = NULL)

Arguments

from
The graphical source file
to
The file name and extension of the converted file
size
Enlarge the converted graphical file by magnifying its resolution with the given number
path
Path to executable 'phantomJS' binary, downloadble from http://phantomjs.org/download.html

Value

Converts the given graphical file to the specified file format.

Examples

Run this code
## Not run: 
# #convert SVG to PNG
# convertGraph("./example.svg", "./example.png", path = "path to executable phantomJS" )
# 
# #convert PNG to JPEG
# convertGraph("./example.png", "./example.jpeg", path = "path to executable phantomJS" )
# 
# #convert JPEG to PDF
# convertGraph("./example.jpeg", "./example.pdf", path = "path to executable phantomJS" )
# ## End(Not run)

Run the code above in your browser using DataLab