convert | R Documentation |
Wrapper function for converting graphics with ImageMagick
convert.g(path = NULL, fileroot= "*", from = "pdf",
to = "png", create.path = TRUE, options = NULL)
path |
String: Path to the from graphic files. If |
fileroot |
String: Graphic root name; default is "*" for all files with the |
from |
String: File type extension specifying the from format. |
to |
String: File type extension specifying the to format. |
create.path |
Logical: Should the output files be placed in a |
options |
Additional options to be passed to the ImageMagick |
Conversion is done through a call to ImageMagick mogrify
function. This means that ImageMagick should be installed on your system. It must also be listed in the path.
For values such as "pdf"
and "eps"
of the from
or to
arguments ImageMagick works in conjunction with Gostscript. The latter should, therefore, also be accessible.
ImageMagick is not suited for vector to vector format conversion because it rasterizes the image before the conversion. Therefore, convert.g
is not suited too for such conversions.
png
, pdf
## Not run:
## Convert all .pdf graphics in the "figSW" directory
## into .png files and put the files in a "png" subfolder.
convert.g(path="figSW", from="pdf", to="png")
## Same, but convert to .jpg files.
convert.g(path="figSW", to="jpg")
## convert file "example.jpg" in current path to ".pdf"
## and put it in same folder.
convert.g(fileroot = "example", from = "jpg", create.path=FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.