to_size: Resize and crop images to a specified size

Description Usage Arguments Value Examples

View source: R/to_size.R

Description

Resize and crop images to a specified size

Usage

1
2
3
4
5
6
7
8
9
to_size(
  stimuli,
  width,
  height = NULL,
  fill = webmorph_options("fill"),
  patch = FALSE,
  squash = FALSE,
  keep_rels = FALSE
)

Arguments

stimuli

of class stimlist

width

the target width (or a vector of width and height)

height

the target height (or null if width is dimensions)

fill

background color if cropping goes outside the original image

patch

whether to use the patch function to set the background color

squash

whether to move template points outside the image boundaries inside the image

keep_rels

whether to keep the size relationships between images in the set, or make all the maximum size

Value

stimlist with cropped tems and/or images

Examples

1
2
3
4
5
6
7
8
stimuli <- c(
  demo_stim("lisa")[[1]],
  demo_stim("composite")[[1]],
  demo_stim("rainbow")[[1]]
)

to_size(stimuli, 300, 400, fill = "red") %>% plot()
to_size(stimuli, 300, 400, fill = "red", keep_rels = TRUE) %>% plot()

facelab/webmorph documentation built on April 11, 2021, 6:34 a.m.