Skip to contents

rotate rotates an image in multiples of 90 degrees.

Usage

rotate(image, rotation = "CLOCKWISE", target = "new")

Arguments

image

An Image object.

rotation

A character string indicating the desired rotation:

  • "CLOCKWISE" (default):rotate by 90 degrees clockwise.

  • "COUNTER":rotate by 90 degrees counterclockwise.

  • "180":rotate by 180 degrees.

target

The location where the results should be stored. It can take 3 values:

  • "new":a new Image object is created and the results are stored inside (the default).

  • An Image object:the results are stored in another existing Image object. This is fast and will not replace the content of image but will replace that of target. Note that target must have the same bit depth and number of channels as image. The dimensions must be the same if rotation="CLOCKWISE", or inverted if rotation="CLOCKWISE" or rotation="COUNTER".

Value

If target="new", the function returns an Image

object. If target is an Image object, the function returns nothing and modifies that Image object in place.

See also

Author

Simon Garnier, garnier@njit.edu

Examples

img <- image(system.file("sample_img/balloon1.png", package = "Rvision"))
img_rotated <- rotate(img)