# pnmrotate

Updated: 30 August 2002
Index

## NAME

pnmrotate - rotate a PNM image by some angle

## SYNOPSIS

pnmrotate [-noantialias] angle [pnmfile]

All options can be abbreviated to their shortest unique prefix.

## DESCRIPTION

pnmrotate reads a PNM image as input. Rotates it by the specified angle and produces the same kind of PNM image as output.

The input is the file named by pnmfile or Standard Input if you don't specify pnmfile. The output goes to Standard Output.

The resulting image is a rectangle that contains the (rectangular) input image within it, rotated with respect to its bottom edge. The containg rectangle is as small as possible to contain the rotated image. The background of the containing image is black.

angle is in decimal degrees (floating point), measured counter-clockwise. It can be negative, but it should be between -90 and 90.

You should use pnmflip instead for rotations that are a multiple of a quarter turn. It is faster and more accurate.

For rotations greater than 45 degrees you may get better results if you first use pnmflip to do a 90 degree rotation and then pnmrotate less than 45 degrees back the other direction.

The rotation algorithm is Alan Paeth's three-shear method. Each shear is implemented by looping over the source pixels and distributing fractions to each of the destination pixels. This has an "anti-aliasing" effect - it avoids jagged edges and similar artifacts. However, it also means that the original colors or gray levels in the image are modified. If you need to keep precisely the same set of colors, you can use the -noantialias flag. This does the shearing by moving pixels without changing their values. If you want anti-aliasing and don't care about the precise colors, but still need a limited *number* of colors, you can run the result through pnmquant.

## REFERENCES

"A Fast Algorithm for General Raster Rotation" by Alan Paeth, Graphics Interface '86, pp. 77-81.

## SEE ALSO

pnmshear, pnmflip, pnmquant, pnm

## AUTHOR

Copyright (C) 1989, 1991 by Jef Poskanzer.

## Index

NAME
SYNOPSIS
DESCRIPTION
REFERENCES
SEE ALSO
AUTHOR