Skip to main content

ImageCrop

ImageCrop (Statement)​

Format​

imagecrop image, x, y, width, height

Description​

Crops an image held in memory down to the rectangle starting at (x, y) with the given width and height, in pixels. The change is made to the image in place — image is the identifier returned by ImageNew, ImageLoad, or ImageCopy.

To trim a uniform border automatically instead of specifying exact bounds, see ImageAutoCrop.

Example​

a = imageload("photo.png")
imagecrop a, 10, 10, 100, 100 # keep a 100x100 region
imagedraw a, 0, 0

See Also​

ImageAutoCrop, ImageCentered, ImageCopy, ImageCrop, ImageDraw, ImageFlip, ImageHeight, ImageLoad, ImageNew, ImagePixel, ImageResize, ImageRotate, ImageSetPixel, ImageSmooth, ImageTransformed, ImageWidth, Unload

Availability​

BASIC-256 2.0 and later. Documented from the BASIC-256 v2.1 continuation project.