Crop - Serabe/rinzelight GitHub Wiki

Theory

Cropping an image is just getting a portion of it.

Practice

crop method admits upto five arguments. The first one is always the original image, and the second and the third are always the width and the height of the resulting image. If there are no more arguments, new image is suppose to start at pixel 0,0. The starting pixel can be explicitly set by passing the coordinates at the end. Nevertheless, using a gravity is advised.

If a explicit starting pixel is passed and the width and height exceeds the original image boundaries are exceeded, it doesn’t raise an exception like Java does, but returns a new image with those pixel set to the default color.

Examples

(crop img 100 50 center)

(crop img 100 60 150 130)

(crop img 100 50 100 50)

⚠️ **GitHub.com Fallback** ⚠️