Rotate - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


ImageTools

  

Rotate

  

rotate an image

 

Calling Sequence

Parameters

Options

Description

Examples

Calling Sequence

Rotate( img, angle, opts )

Parameters

img

-

Image; input image

angle

-

amount of rotation, in radians, counter-clockwise around the image center.

opts

-

(optional) equation(s) of the form option = value; specify options for the Rotate command

Options

• 

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.

Description

• 

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.

Examples

withImageTools:

imgCreate100,200,r,c0.5+evalf0.5expc50sinr20

img1Rotateimg,90,degrees

img2Rotateimg,180,degrees

img3Rotateimg,270,degrees

img4Rotateimg,π4.0

img5Rotateimg,π3.0,background=white

Embedimg,img1,img2,img3,img4,img5

Rotateimg,π4.0,extent

270,354

(5.1)

See Also

ImageTools

ImageTools[Flip]

ImageTools[Transpose]