# image.rotate

image.rotate is a function that is part of the image library.

Returns a copy of the input image rotated counterclockwise by the amount of degrees given.

This has been introduced in TI-Nspire OS 3.2 (Changes).

## Syntax

image.rotate(yourImage, angle) ( or yourImage:rotate(angle) )

Parameter Type Description
yourImage
TI.Image Image you want to rotate, created with image.new()
angle
number the angle in degrees you want to rotate your image by.

## Example

local sc = 0.15
local imw = earth:width()
local imh = earth:height()
local im = earth:copy(sc*imw, sc*imh)
im = im:rotate(-tilt)
local midx = im:width()/2 -- this is the important bit for having the right coordinates
local midy = im:height()/2
local x = w/4 - midx
local y = h/2 - midy
gc:drawImage(im, x, y) -- we must be in a gc-passed function (like on.paint(gc))
imw, imh = im:width(), im:height()

## Good to know

The image changes size when you rotate it. So you need to figure where to draw it based on the middle of its rotated size. By experimenting with it, you'll quickly notice that need ;)