BWRECT(1)
π BWRECT(1) β the bwrect girlies' guide π
okay so real quick, this is bwrect from the BRL-CAD fam, and bestie, it's lowkey one of the most useful little tools in the whole toolbox. it does exactly one thing and it does it slayfully. π
β¨ NAME β¨
bwrect β extract a rectangle from a black and white bw file. that's it. that's the whole vibe. π«Ά
πΈ SYNOPSIS πΈ
bwrect [-s squaresize] [-w width] [-n height] [-S out_squaresize] [-W out_width] [-N out_height] [-x xorig] [-y yorig] [-o out_file.bw] [file.bw] [> out_file.bw]
π DESCRIPTION π
so what bwrect does is it goes into a black and white bw(5) format file and pulls out a rectangular region. like cropping a photo for the grid, except it's a bw file and it's iconic. β¨
the default input image size is 512x512. but here's the thing you cannot skip, bestie β the output width and height must be explicitly specified (using -W and -N, or -S), because they default to zero. so if you forget, you get nothing. it's giving "no thoughts, head empty." π
no input file? no problem β bwrect reads from standard input. no output file via -o? also fine β it writes to standard output. which means this utility is literally built to live in your pipelines. main character energy, fr fr. π¦
π₯ OPTIONS π₯
-s squaresizeβ sets both the width and height of the input image to squaresize in pixels. one flag, two jobs, efficient queen. π-w widthβ specifies the width of the input image in pixels (default is512).-n heightβ specifies the height of the input image in scanlines (default is512). yes, scanlines, not pixels β that's the unit for height here, noted and respected. π-S out_squaresizeβ sets both the width and height of the extracted output rectangle to out_squaresize in pixels. the shortcut for when you want a cute square crop. π-W out_widthβ specifies the width of the extracted output rectangle in pixels.-N out_heightβ specifies the height of the extracted output rectangle in scanlines.-x xorigβ specifies the x-coordinate of the origin for the extraction (default is0).-y yorigβ specifies the y-coordinate of the origin for the extraction (default is0). heads up: the origin corresponds to the lower-left corner. so y grows upward, okurrr. π-o out_file.bwβ specifies the name of the output file. and listen: if standard output is also redirected or piped,bwrectwrites the same output to both destinations. double the output, double the fun, no cap. if-oisn't provided, output is written to standard output. π
π¦ EXAMPLES π¦
Example 1. Extracting a 256x256 rectangle from a 1024x1024 image
$ bwrect -s 1024 -S 256 -x 0 -y 0 in.bw > out.bw
this command extracts a 256x256 rectangle from the lower-left corner of the 1024x1024 image in.bw and writes it to out.bw using standard output redirection. ate and left no crumbs. π₯
Example 2. Extracting a 100x100 region with a specific origin and output file
$ bwrect -W 100 -N 100 -x 200 -y 200 -o out.bw in.bw
this command extracts a 100x100 rectangle starting at coordinate (200, 200) from an image of default size (512x512) and saves it directly to out.bw using the -o option. chef's kiss. π
β SEE ALSO β
brlcad(1), bwcrop(1), bwscale(1), pixrect(1), bw(5) β go read the whole squad, iykyk. π«
π 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. periodt. β
π BUG REPORTS π
Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org. don't be shy, they're nice, i promise. π
okay that's the whole page bestie, go crop some rectangles and be iconic. this beauty comes to you courtesy of BRL-CAD β the BWRECT(1) page, sitting pretty in the BRL-CAD manual set, with that copyright window running 1989-2026. mwah, love u, bye! ππ§β¨
π¦ 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