transform_crop: Crop the given image at specified location and output size

transform_cropR Documentation

Crop the given image at specified location and output size

Description

Crop the given image at specified location and output size

Usage

transform_crop(img, top, left, height, width)

Arguments

img

A magick-image, array or torch_tensor.

top

(int): Vertical component of the top left corner of the crop box.

left

(int): Horizontal component of the top left corner of the crop box.

height

(int): Height of the crop box.

width

(int): Width of the crop box.

See Also

Other unitary_transforms: transform_adjust_brightness(), transform_adjust_contrast(), transform_adjust_gamma(), transform_adjust_hue(), transform_adjust_saturation(), transform_affine(), transform_center_crop(), transform_convert_image_dtype(), transform_grayscale(), transform_hflip(), transform_linear_transformation(), transform_normalize(), transform_pad(), transform_perspective(), transform_resize(), transform_rgb_to_grayscale(), transform_rotate(), transform_to_tensor(), transform_vflip()


torchvision documentation built on Nov. 6, 2025, 9:07 a.m.