Skip to contents

Resize and crop/pad images to a specified size

Usage

to_size(
  stimuli,
  width = NULL,
  height = NULL,
  fill = wm_opts("fill"),
  crop = FALSE,
  keep_rels = FALSE
)

Arguments

stimuli

list of stimuli

width

the target width (if null, the maximum stimulus width is used)

height

the target height (if null, the maximum stimulus height is used)

fill

background color if cropping goes outside the original image, see color_conv()

crop

whether to crop or pad images to make them the specified size

keep_rels

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

Value

list of stimuli with cropped tems and/or images

See also

Stimulus manipulation functions align(), crop_tem(), crop(), greyscale(), horiz_eyes(), image_func(), mask_oval(), mask(), mirror(), pad(), resize(), rotate()

Examples


# images with different aspect ratios and sizes
stimuli <- demo_unstandard(c(1:4, 6:9))

to_size(stimuli, 200, 200, fill = "dodgerblue")