PIXRECT(1)
π PIXRECT β ok bestie, let's crop a pic β¨
Hey so this is pixrect, from the BRL-CAD fam (manual section 1, she's iconic), and honestly? She's the friend who just snips a rectangle out of a color pix file and hands it back to you all clean. π
β¨ SYNOPSIS β¨
pixrect [-s squaresize] [-w width] [-n height] [-S out_squaresize] [-W out_width] [-N out_height] [-x xorig] [-y yorig] [-o out_file.pix] [file.pix] [> out_file.pix]
πΈ DESCRIPTION πΈ
Okay so pixrect extracts a rectangular sub-region out of a pix(5) format color image and writes the cropped result as a brand-new pix(5) image. That's it, that's the whole vibe. π
Why do you care? Because it's literally built for pulling a portion out of a potentially very large image without loading unrelated scanlines. No cap β she only reads what she needs. Main character energy. π
The input dimensions default to 512x512 pixels. Where does the region start? That's xorig and yorig, which default to 0,0 β the lower left corner of the image. π¦
The size of the extracted region comes from the output dimension options and you have to specify it. Bestie, listen: the output width and height default to 0, and if either is left unset pixrect will report an error and exit. Not a drill. π
Input is read from file.pix if you give one, otherwise from standard input. Output goes to standard output and/or to the file you name with -o. Both. At the same time. It's giving generous. π«Ά
π OPTIONS π
-ssquaresize β sets both the input width and height to squaresize pixels. One number, two vibes. β¨-wwidth β sets the input scanline width, in pixels (default512).-nheight β sets the input height, in scanlines (default512).-Sout_squaresize β sets both the output width and height to out_squaresize pixels. Square output, square heart. π-Wout_width β sets the output width, in pixels.-Nout_height β sets the output height, in scanlines.-xxorig β sets the x coordinate of the lower left corner of the region to extract (default0).-yyorig β sets the y coordinate of the lower left corner of the region to extract (default0).-oout_file.pix β writes the extracted image to out_file.pix. And if standard output is also redirected or piped, the same image gets written to both destinations. Two slays, one command. π
π¦ EXAMPLES π¦
Example 1. Crop a 256x256 tile from a large image
pixrect -w 1024 -n 1024 -x 384 -y 384 -S 256 image.pix > center.pix
So here we're treating image.pix as a 1024x1024 image and extracting a 256x256 square starting at pixel (384,384), which produces a centered tile in center.pix. Perfectly centered. Obsessed. π₯°
Example 2. Extract a region and view it directly
pixrect -s 512 -x 0 -y 256 -W 512 -N 256 render.pix | pix-fb -w 512 -n 256
This one pulls the top half of a 512x512 image and pipes the 512x256 result straight to a framebuffer with pix-fb(1) for immediate inspection. Pipe it and look at it, no intermediate file, we love efficiency. π₯
π SEE ALSO π
brlcad(1), bwrect(1), pix-fb(1), pix(5), bw(5)
Go say hi to the whole friend group. π«Ά
π AUTHOR π
BRL-CAD Team β legends, honestly.
π COPYRIGHT π
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
Found something cursed? Don't suffer in silence, bestie β email the address above. π
And that's the page! This lil icon lives in BRL-CAD (that's the source/version, mwah π
), and yeah, pixrect(1) is the manual she belongs to. Go crop something cute. ππ§β
π¦ where this page comes from
- nixpkgs unstable: brlcad 7.44.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms