Method Image.Image()->autocrop()


Method autocrop
Method find_autocrop

object autocrop()
object autocrop(int border)
object autocrop(int border, Color color)
object autocrop(int border, int left, int right, int top, int bottom)
object autocrop(int border, int left, int right, int top, int bottom, Color color)
array(int) find_autocrop()
array(int) find_autocrop(int border)
array(int) find_autocrop(int border, int left, int right, int top, int bottom)

Description

Removes "unnecessary" borders around the image, adds one of its own if wanted to, in selected directions.

"Unnecessary" is all pixels that are equal -- ie if all the same pixels to the left are the same color, that column of pixels are removed.

The find_autocrop() function simply returns x1,y1,x2,y2 for the kept area. (This can be used with copy later.)

Parameter border
Parameter left
Parameter right
Parameter top
Parameter bottom

which borders to scan and cut the image; a typical example is removing the top and bottom unnecessary pixels:

img=img->autocrop(0, 0,0,1,1);

Returns

the new image object

See also

copy