BWRECT(1)

πŸ“¦
version 7.44.0 Β· 2 versions
, in nixpkgs unstable

πŸŽ€ 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 is 512).
  • -n height β€” specifies the height of the input image in scanlines (default is 512). 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 is 0).
  • -y yorig β€” specifies the y-coordinate of the origin for the extraction (default is 0). 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, bwrect writes the same output to both destinations. double the output, double the fun, no cap. if -o isn'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. 🫑

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