rotate an image
Rotate( img, angle, opts )
Image; input image
amount of rotation, in radians, counter-clockwise around the image center.
(optional) equation(s) of the form option = value; specify options for the Rotate command
output = Image
Specifies a data structure into which the output is written. This can be used to avoid allocating memory. The size and number of layers must match that of the input. The dimensions of the output image are adjusted so that the row and column indices match the input. The default is NULL.
If no output option is specified, Rotate will allocate an output image based on what the extent option would return.
The degrees option is used to indicate that the rotation is given in degrees instead of radians.
If the extent option is given, Rotate returns the height and width of a (possibly larger) image in which the input image must be centered to ensure that no part of the input image is lost during the rotation. This can be used to allocate a suitable image for the output option.
The background option specifies a color to be used to fill in the extra space around the rotated input image. If not specified, Rotate will use a default of 50% gray. Furthermore, for RGBA images, the alpha channel will be set to 0 (i.e., completely transparent). The background can be specified as a numeric value, a list of 3 or 4 numeric values, or the names black or white.
The Rotate command returns an image that has been rotated by the specified angle.
The img parameter is of type Image.
The angle parameter specifies the angle of rotation in a counter-clockwise direction. It may be a numeric value, or one of the names left or right. An angle of Pi/2 radians is equivalent to left.
If an image is rotated such that it would fit better in a rectangle rotated 90 degrees relative to the input, the output image will have its dimensions exchanged. For example, rotating a 400 by 300 image by Pi/3 radians (60 degrees) will produce a 300 x 400 image. Thus, the dimensions of the output image should always be checked before attempting to index into it.
img ≔ Create⁡100,200,r,c→0.5+evalf⁡ⅇ−c50⋅0.5⁢sin⁡r20
img1 ≔ Rotate⁡img,90,'degrees'
img2 ≔ Rotate⁡img,180,'degrees'
img3 ≔ Rotate⁡img,270,'degrees'
img4 ≔ Rotate⁡img,Pi4.0
img5 ≔ Rotate⁡img,Pi3.0,'background'='white'
Download Help Document