| Extracted from Pike v7.8 release 866 at 2018-07-18.

[Top]
Image
Image.Image

# Method Image.Image()->find_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 "unneccesary" borders around the image, adds one of its own if wanted to, in selected directions.

  "Unneccesary" 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 unneccesary pixels:

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

Returns

  the new image object

See also

  copy