ROTATE: Rotate an Image

 
Form: ROTATE source [LEFT] [RIGHT] [UD] [PA=degrees] [BOX=b]
[TRANSPOSE] [SINC]
source
the buffer containing the image to be rotated.
LEFT
rotates the image LEFT (counterclockwise).
RIGHT
rotates the image RIGHT (clockwise).
UD
turns the image upside-down.
TRANSPOSE
transposes the image.
PA=degrees
rotates the image by the specified number of degrees.
BOX=b
gives the size of the output image when the rotation is specified in degrees.
SINC
uses 2-D sinc interpolation, rather than bilinear, for general rotation.
This command rotates an image. The keywords LEFT, RIGHT and UD are used for simple rotations. These operate on the entire image. The directions LEFT or RIGHT or UD refer to the orientation of the image as seen on the image display or in a contour map. Imagine the image drawn or a piece of paper for these rotations. UD is the same as two LEFT or two RIGHT rotations done in sequence. It does NOT produce the a result which can be done with FLIP. The keyword TRANSPOSE will transpose the image, i.e. change the columns into rows and vice versa; this is equivalent to a ROTATE LEFT plus a FLIP ROWS or a FLIP ROWS plus a ROTATE RIGHT.

Use PA= to specify an arbitrary rotation in degrees. PA=0 is vertical as seen on the television, with positive rotation angles corresponding to a counterclockwise rotation. A box may be specified, in which case the whole image will be rotated around the center of the box, then windowed to fit into the box. The box coordinates should be specified in the ROTATED coordinate frame, not in the original frame. If no box is specified, a box the size and position of the whole image is assumed. Note that in this case some corners may be cut off in the rotated image, while others may be filled with zeros. Arbitrary rotations require interpolation to be done on the data. The default method is bilinear interpolation, but higher accuracy 2-D sinc interpolation will be used if the SINC keyword is given.

Note that RIGHT and PA=90 (for example) are not equivalent. The RIGHT keyword implies a simple shuffling around of the pixel values, while PA=90 will actually attempt to interpolate the values. Another difference lies in the way the resulting image is proportioned: PA=90 will result in an image with the same number of rows and columns as the original, but RIGHT will result in an image with the number of rows and columns reversed.

ROTATE 4 LEFT
Rotates all of image 4 90 degrees in a counter-clockwise direction.
ROTATE 1 BOX=6 PA=145
Rotates image 1 by 145 degrees and keeps only the part of the rotated image which lies in box 6.