BUILT-IN MATHEMATICA SYMBOL

# ImageCrop

ImageCrop[image]
crops image by removing borders of uniform color.

ImageCrop[image, size]
crops image based on the size specification size.

ImageCrop[image, size, spec]
crops image by removing pixels from sides specified by spec.

## Details and OptionsDetails and Options

• ImageCrop[image] effectively removes borders from image whose pixel value distribution is almost uniform.
• ImageCrop[image, {w, h}] by default removes pixels symmetrically from image, or if w or h is larger than for image, it adds pixels symmetrically.
• The image size specification size in ImageCrop[image, size] can have the following forms:
•  width particular width; height based on aspect ratio {width} maximum width {width,height} particular width and height {width,depth,height} particular width, depth, and height in 3D
• Specifications for either of the dimensions can be any of the following:
•  d d pixels {d} maximum d pixels {dmin,dmax} pixel ranges Automatic determine value from aspect ratio Full do no cropping in this dimension
• The cropping specification spec in ImageCrop[image, size, spec] can have the following forms:
•  side crop on the specified side; center otherwise {side1,side2} crop on the specified sides {ax,ay} assign a fraction of cropping to each side
• Sides can be specified as Left, Right, Bottom, or Top. Center indicates symmetrical cropping.
• Cropping fractions are between and . In the horizontal case, is equivalent to Left, to Right, and to Center. In the vertical case, is equivalent to Bottom, and to Top.
• ImageCrop[image, size] is equivalent to ImageCrop[image, size, Center].
• To obtain an image with an aspect ratio r, use ImageCrop[image, width{1, r}].
• If the final image specified by ImageCrop[image, ...] extends beyond image, then pixels are added according to the setting for Padding.

## ExamplesExamplesopen allclose all

### Basic Examples (7)Basic Examples (7)

Automatically crop uniform borders:

 Out[1]=

Crop an image to 100 by 100 pixels:

 Out[1]=

Crop to a width of 100 pixels and a height of 50 pixels:

 Out[1]=

Crop at the left side, preserving the aspect ratio:

 Out[1]=

Crop at the right side only:

 Out[1]=

Crop at the left side and the bottom:

 Out[1]=

Padding is used if a size larger than the original size is specified:

 Out[1]=