Learn R Programming

ggpattern (version 0.1.3)

img_read_as_array: Fetch a given path or URL as a 3D RGB array of values

Description

Fetch a given path or URL as a 3D RGB array of values

Usage

img_read_as_array(
  filename,
  width = NULL,
  height = NULL,
  fill_type = "squish",
  gravity = "Center",
  scale = 1,
  filter = "lanczos"
)

Arguments

filename

filename or URL

width, height

if specified scale the image to these dimensions before converting to an array

fill_type

how to fill the image area. 'none', 'fit', 'squish', 'expand', 'tile'

gravity

imagemagick gravity option on how to position an image during a resize/fill

scale

scale image prior to tiling. Only for fill_type == 'tile'

filter

filter for scaling. default: lanczos. only for fill_type = 'tile'

Value

3D array. If the image was pure gray, then it will be promoted to be an unsaturated RGB image.