Skip to content

crop()

Crop the image to a rectangular region.

icon.crop(x, y, width, height)

Keeps the part of the image starting at (x, y) and extending the given width and height; the rest is discarded.

Parameters

icon.crop(x, y, width, height)
Parameter Type Default Description
x int or float required The horizontal start of the region, in pixels from the image's top-left.
y int or float required The vertical start of the region, in pixels from the image's top-left.
width int or float required The width of the region to keep, in pixels.
height int or float required The height of the region to keep, in pixels.