Pike v8.0 release 1738

Method Image.Layer()->find_autocrop()


Method find_autocrop

object autocrop()
object autocrop(bool left, bool right, bool top, bool bottom)
array(int) find_autocrop()
array(int) find_autocrop(bool left, bool right, bool top, bool bottom)

Description

This crops (of finds) a suitable crop, non-destructive crop. The layer alpha channel is checked, and edges that is transparent is removed.

(What really happens is that the image and alpha channel is checked, and edges equal the fill setup is cropped away.)

find_autocrop() returns an array of xoff,yoff,xsize,ysize, which can be fed to crop().

Note

A tiled image will not be cropped at all.

left...bottom arguments can be used to tell what sides cropping are ok on.

See also

crop, Image.Image->autocrop