save_phylopic: Save a PhyloPic image

View source: R/save_phylopic.R

save_phylopicR Documentation

Save a PhyloPic image

Description

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).

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).

Value

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

Examples

## Not run: 
# Get image data
img <- get_phylopic("27356f15-3cf8-47e8-ab41-71c6260b2724")
# Save file
save_phylopic(img = img, path = "./phylopic.png",
              width = 500, height = 500)

## End(Not run)

rphylopic documentation built on Nov. 2, 2023, 6:13 p.m.