Skip to documentation
DocumentationAll documentsEnglish

PIXCROP(1)

NAME

pixcrop - crop color pix files

On this page

SYNOPSIS

pixcrop in.pix out.pix
pixcrop in.pix out.pix inwidth outwidth outheight ulx uly urx ury lrx lry llx lly

DESCRIPTION

pixcrop crops any quadrilateral out of an arbitrarily large pix(5) input file (in.pix), squares that region to a given height and width output size, and writes the result to out.pix. The first form of pixcrop prompts for all parameters it needs to do the cropping. All responses should be pixel counts or first quadrant coordinates. The second form allows all of the needed parameters to be given on the command line and is intended for use from shell scripts. The coordinate names (the eight arguments listed above after outheight) refer to the input file, and more specifically to upper-left-x (ulx), lower-right-y (lry), etc., in clockwise-from-upper-left order.

The nearest input pixel is selected for each output pixel. No interpolation is done by this program. pixcrop takes no command-line options; all parameters are supplied either interactively or as the positional arguments shown in the second synopsis form.

EXAMPLES

Example 1. Crop an upright 200x100 region out of a 512-wide image
pixcrop in.pix out.pix 512 200 100 100 400 300 400 300 200 100 200

Reads the 512-pixel-wide in.pix and writes a 200x100 out.pix extracted from the axis-aligned rectangle whose input corners are upper-left (100,400), upper-right (300,400), lower-right (300,200), and lower-left (100,200). Because the four corners need not form a rectangle, skewed or sheared quadrilaterals can be rectified into an upright output image.

SEE ALSO

brlcad(1), pixrect(1), pixscale(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