image_load: Load PNG, JPG, BMP or GIF

View source: R/load.R

image_loadR Documentation

Load PNG, JPG, BMP or GIF

Description

Load PNG, JPG, BMP or GIF from disk or URL.

Usage

image_load(file)

Arguments

file

character, file name. A local file or URL. Extension must be one of png, jpg, jpeg, bmp or gif.

Details

The function will prompt you of the need to install a format-specific package if not installed and needed for the given file extension; png, bmp, magick (for GIF). jpeg is already imported for purpose of running examples.

Value

an RBG array

Examples

x <- paste0(system.file(package = "imgpalr"), "/blue-yellow.",
  c("jpg", "png", "bmp", "gif"))
str(image_load(x[1]))
if(require(png)) str(image_load(x[2]))
if(require(bmp)) str(image_load(x[3]))
if(require(magick)) str(image_load(x[4]))

imgpalr documentation built on Sept. 10, 2023, 9:06 a.m.