rotates image by 90° about its center in the - plane.


rotates image by θ radians.


rotates a 3D image around the 3D vector w.


gives an image of the specified size.

Details and Options

  • ImageRotate[image,] rotates image about its center.
  • For 2D images, ImageRotate[image,side] rotates image to make the top of the image be on the specified side. ImageRotate[image,side1->side2] rotates image to make side1 be on side2. Possible side specifications are: Top, Bottom, Left, Right.
  • ImageRotate[image,side] is equivalent to ImageRotate[image,Top->side].
  • Possible specifications for size include:
  • widthcrop to width
    {width,height}crop to {width,height}
    {width,depth,height}crop a 3D image to {width,depth,height}
    Automaticsmallest rectangle to enclose all of the rotated image
    Allsmallest square to accommodate the rotated image for any rotation angle
    Fulluse the dimensions of the input image
    "MaxAreaCropping"crop to include only input pixels while maximizing area
    "SameRatioCropping"crop to include only input pixels while preserving ratios
  • The following options are supported:
  • Background0background color to use
    MaskingAllregion of interest to be rotated
    Padding0padding of the original image
    ResamplingAutomaticresampling method
  • Masking option can be one of the following:
  • Allinput image only
    Fullinput image and padding
    maskany mask image


open allclose all

Basic Examples  (2)

Rotate an image counterclockwise by 90°:

Rotate an image counterclockwise by 20°:

Scope  (6)

Data  (3)

Rotate a grayscale image:

Rotate a color image:

Rotate a 3D image in the - plane:

Rotation Angle  (2)

Turn a photo to the right:

Rotate the photo 180°:

Specify the amount of the rotation in radians:

Rotate the photo by 45°:

By default, the image is rotated around the axis:

Rotate 3D image around the axis:

Rotate around the main diagonal:

Output Size  (1)

By default, padding is used to show the smallest rectangle that encloses all of the rotated image:

Crop to the size of the original image:

Crop to the specified width:

Crop to the input image pixels while preserving aspect ratio:

Crop to the input image pixels while maximizing area:

Crop to the smallest square that accommodates all rotation angles:

Options  (5)

Background  (1)

By default, a black background is used:

Use a transparent background:

Use a specific color for the background:

Images with an alpha channel use a transparent background by default:

Masking  (1)

By default, MaskingAll is used, and background value is used for pixels outside of the original image:

Use MaskingFull to see padded values for pixels outside of the original image:

Use arbitrary mask:

Padding  (1)

By default, "Fixed" padding is used:

Specify the padding scheme:

Use a constant padding:

Resampling  (2)

By default, the rotated image is resampled with the most suitable method:

Rotate an image using a specific resampling algorithm:

Applications  (1)

Switch photo to its natural orientation:

Rotate an image to correct for upside-down text:

Properties & Relations  (1)

ImageRotate performs a rotation about the center:

Use ImageTransformation and RotationTransform to rotate the image:

Rotate about a different center using ImageTransformation:

Rotate a 3D image around the x-axis:

Use ImageTransformation and RotationTransform to rotate the image:

Interactive Examples  (1)

Interactive rotation around the image center with different size settings:

Introduced in 2008
Updated in 2012