ImageTrim

ImageTrim[image,{pt1,pt2,}]
gives the smallest subimage of image that includes all of the specified points.

ImageTrim[image,{pt1,pt2,},r]
adds a margin of size r back to the resulting image.

Details and OptionsDetails and Options

  • In 2D, ImageTrim assumes that points are in the standard image coordinate system, where runs from to image width and runs from to image height. The point corresponds to the bottom-left corner of the image.
  • In 3D, ImageTrim assumes that points are in the standard 3D image coordinate system, where x runs from to width, y runs from to depth, and z runs from to height. The point corresponds to the bottom-left front corner.
  • If fewer elements exist than are requested, ImageTrim will just return the elements that are present.
  • By setting a Padding option, pixels outside the original image can also be included. »
  • For integer coordinate values the trimmed image will include all pixels touching the point . Coordinates lie at the center of pixels.
  • ImageTrim takes a DataRange option that specifies the range of pixels in the input image. The default setting is DataRange->Full. See the reference page for ImageValue for all possible settings.
  • ImageTrim[image,{{x1,y1},},{rx,ry}] specifies different horizontal and vertical margins.
Introduced in 2010
(8.0)
| Updated in 2012
(9.0)