crop: Crop images

View source: R/crop.R

cropR Documentation

Crop images

Description

Crops selected frames to a given geometry. Wraps magick::image_crop.

Usage

crop(images, geometry, gravity = NULL, repage = TRUE, frames = NULL)

Arguments

images

an object of class magick-image to modify

geometry

a geometry string specifying the cropped region, e.g. "100x100+10+10" (widthxheight+x_offset+y_offset).

gravity

anchor point for the crop: one of "NorthWest", "North", "NorthEast", "West", "Center", "East", "SouthWest", "South", "SouthEast". Defaults to NULL (top-left).

repage

logical. If TRUE (default), resets the virtual canvas after cropping.

frames

integer vector of frame indices to duplicate. Defaults to NULL, which duplicates all frames.

Value

a magick-image object

Verbosity

After each operation a message listing the updated frame sequence is printed in interactive sessions. Use stopmotion_verbosity(FALSE) to suppress these messages, or set options(stopmotion.verbose = FALSE) in your script or ‘.Rprofile’.

Examples


  dino_dir <- system.file("extdata", package = "stopmotion")
  images <- read(dir = dino_dir)
  crop(images = images, geometry = "200x200+50+50")
  crop(images = images, geometry = "200x200", gravity = "Center", frames = 1:3)


stopmotion documentation built on March 24, 2026, 5:06 p.m.

Related to crop in stopmotion...