Lucee Function Reference
imagecrop()
Crops an image to a specified rectangular area. The function modifies the original image by extracting the defined region. If the specified crop area extends beyond the image boundaries, the function automatically adjusts to fit within the image dimensions.
Example
imagecrop(any image,number x,number y,number width,number height):void
Category
image
Arguments
The arguments for this function are set. You can not use other arguments except the following ones.
| Name | Type | Required | Description |
|---|---|---|---|
| image | any | Yes | The source image object to be cropped. Can be either an image object or a string containing the image path. |
| x | number | Yes | The X coordinate of the top-left corner of the crop area, measured in pixels from the left edge of the image. |
| y | number | Yes | The Y coordinate of the top-left corner of the crop area, measured in pixels from the top edge of the image. |
| width | number | Yes | The width of the crop area in pixels. If this extends beyond the image's right edge, it will be automatically adjusted to the image boundary. |
| height | number | Yes | The height of the crop area in pixels. If this extends beyond the image's bottom edge, it will be automatically adjusted to the image boundary. |