ImageRotate

ImageRotate[image]

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

ImageRotate[image,θ]

rotates image by θ radians.

ImageRotate[image,{θ,w}]

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

ImageRotate[image,,size]

gives an image of the specified size.

ImageRotate[video,]

rotate frames of video.

Details and Options

  • ImageRotate[image,] rotates image about its center.
  • For video inputs, the rotation specification can be a fixed specification for all frames or a function of time (in seconds from the start).
  • For 2D images and videos, ImageRotate[input,side] rotates input to make the top of the image be on the specified side. ImageRotate[input,side1->side2] rotates input 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:
  • Background 0background color to use
    Masking Allregion of interest to be rotated
    Padding 0padding of the original image
    Resampling Automaticresampling method
  • Masking option can be one of the following:
  • Allinput image only
    Fullinput image and padding
    maskany mask image

Examples

open allclose all

Basic Examples  (2)

Rotate an image counterclockwise by 90°:

Rotate an image counterclockwise by 20°:

Scope  (8)

Data  (4)

Rotate a grayscale image:

Rotate a color image:

Rotate frames of a video:

Rotate a 3D image in the - plane:

Rotation Angle  (3)

Turn a photo to the right:

Rotate the photo 180°:

Specify the amount of the rotation in radians:

Rotate the photo by 45°:

Rotate frames of a video with a time dependent rotation:

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  (2)

Switch photo to its natural orientation:

Rotate an image to correct for upside-down text:

Create a function to output a rotation amount as a function of time:

Rotate the frames of a video using the function:

Properties & Relations  (2)

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:

Wolfram Research (2008), ImageRotate, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageRotate.html (updated 2021).

Text

Wolfram Research (2008), ImageRotate, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageRotate.html (updated 2021).

CMS

Wolfram Language. 2008. "ImageRotate." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/ImageRotate.html.

APA

Wolfram Language. (2008). ImageRotate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageRotate.html

BibTeX

@misc{reference.wolfram_2022_imagerotate, author="Wolfram Research", title="{ImageRotate}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/ImageRotate.html}", note=[Accessed: 09-December-2022 ]}

BibLaTeX

@online{reference.wolfram_2022_imagerotate, organization={Wolfram Research}, title={ImageRotate}, year={2021}, url={https://reference.wolfram.com/language/ref/ImageRotate.html}, note=[Accessed: 09-December-2022 ]}