Skip to contents

save_phylopic is a convenient function for saving a PhyloPic silhouette fetched via get_phylopic. Available formats for saving are those available in the grDevices package (i.e. pdf, png, svg, tiff, jpeg, and bmp).

Usage

save_phylopic(img = NULL, path = NULL, bg = "transparent", ...)

Arguments

img

picture. A Picture object. For PhyloPic silhouettes, this is generated by get_phylopic and pick_phylopic.

path

character. The output file path. The name of the file and file extension should be included (e.g. "./phylopic.png"). If this argument is NULL (default), the file is automatically saved in the current working directory as a png file.

bg

character. The desired background color. By default this argument is set to "transparent". Note: .jpeg files are always exported with a background colour.

...

Additional arguments available for the called grDevices function. The called function is determined by the file extension used in path (e.g. png).

Value

An image is saved. Nothing is returned to the R interface.

Details

This function can be used to save a PhyloPic image obtained via the get_phylopic or any object of class Picture from the grImport2 package. Any file format available in the grDevices package can be used (i.e. pdf, png, svg, tiff, jpeg, and bmp).

Examples

if (FALSE) { # \dontrun{
# Get image data
img <- get_phylopic("27356f15-3cf8-47e8-ab41-71c6260b2724")
# Save file
save_phylopic(img = img, path = "./phylopic.png",
              width = 500, height = 500)
} # }