Skip to documentation
DocumentationAll documentsEnglish

PIXROT(1)

NAME

pixrot - rotate, invert, or reverse a color pix file

On this page

SYNOPSIS

pixrot [-f] [-b] [-r] [-i] [-#bytes] [-s squaresize] [-w width] [-n height] [file.pix] > newfile.pix

DESCRIPTION

pixrot rotates, inverts, and/or reverses a pix(5) format color image, reading from the named file or from standard input and writing the result to standard output. The input dimensions are given with -w (width) and -n (height), or with -s when the image is square; both default to 512.

The -r flag reverses each scan line left to right, and -i inverts the image top to bottom. The -f and -b flags rotate the image ninety degrees forward or backward respectively, where the sense is relative to a first-quadrant coordinate system (origin lower left) with "forward" meaning clockwise. A 180 degree rotation is obtained by both reversing and inverting.

By default three-byte (RGB) pixels are assumed. The -# bytes flag selects a different element size, so the same program can rotate rectangular arrays of any fixed-width datum, such as floating point values or fixed-width text.

The output is written largely in scan-line order; if the image is too large to hold in memory at once, pixrot seeks on output, so standard output must be a seekable file rather than a pipe for the rotation modes.

OPTIONS

-f

Rotate the image ninety degrees forward (clockwise).

-b

Rotate the image ninety degrees backward (counter-clockwise).

-r

Reverse each scan line left to right.

-i

Invert the image top to bottom.

-# bytes

Set the number of bytes per pixel (default 3, as in pix(5)).

-s squaresize

Set both the input width and height to squaresize pixels (also -S).

-w width

Set the input width in pixels (default 512, also -W).

-n height

Set the input number of scan lines in pixels (default 512, also -N).

-h

Print a usage message.

EXAMPLES

Example 1. Rotate a rendered frame and view it
rt -o frame.pix -w 1024 -n 768 model.g component.r
pixrot -w 1024 -n 768 -f frame.pix > frame-rot.pix
pix-png -w 768 -n 1024 frame-rot.pix > frame-rot.png

Render a 1024x768 image with rt(1), rotate it ninety degrees clockwise (note the rotated image is 768x1024), then convert it to PNG with pix-png(1).

Example 2. Flip an image 180 degrees
pixrot -s 512 -r -i image.pix > image-180.pix

Combine a left-to-right reversal with a top-to-bottom inversion to turn a 512x512 image upside down.

SEE ALSO

brlcad(1), bwrot(1), pixscale(1), pixrect(1), pix-png(1), pix(5)

AUTHOR

BRL-CAD Team

This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory.

BUG REPORTS

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org