PIXBGSTRIP(1)
π PIXBGSTRIP(1) β bestie's guide to the BRL-CAD pixel background stripper π
okay so this is pixbgstrip from the BRL-CAD crew, and it's genuinely one of those little tools that eats every single time. no cap. β¨
πΈ NAME πΈ
pixbgstrip β strips a uniform background color out of a pix(5) file π«Ά
β¨ SYNOPSIS β¨
pixbgstrip [-a] [-t thresh] [-x x_offset] [-s squaresize] [-w width] [-n height] [file.pix]
like, that's the whole vibe. flags then a file, or no file at all, iykyk π
π DESCRIPTION π
So pixbgstrip reads a pix(5) image from the file you name β or from standard input if you don't name one, main character energy β and then writes a brand new pix(5) image to standard output where the background color has been replaced with black (0/0/0). literally that's it and it's iconic.
Here's the tea on how it actually works: for each scanline, the pixel sitting at the background X offset (peep -x) gets grabbed and used as the reference background color for that line. Every pixel on that scanline whose color falls within the matching threshold (that's -t) of the reference gets set to black, and every other pixel gets passed through unchanged, untouched, unbothered. π
This is lowkey perfect for keying out a solid or smoothly shaded backdrop β like, say, the kind pixbackgnd(1) produces β before you composite an image over a whole new background. it's giving chroma key but make it pix. π¦
Also important bestie: the image dimensions have to be known so the program can read each scanline properly. By default the input is assumed to be 512x512 pixels. You can set the dimensions explicitly with -w, -n, and -s, or let the program guess from the file length with -a. your call, no pressure. π
π OPTIONS π
-aβ autosize the input π« the length of the input file gets compared against a table of common image sizes, and if there's a match, the corresponding width is used. only works when reading from a file β not from a pipe, bestie, don't try it. π-t threshβ set the matching threshold (default0). a pixel only counts as background if each of its red, green, and blue channels differs from the reference background pixel by less than thresh. bigger value = tolerates a slightly noisy background. slay. π₯-x x_offsetβ set the X offset, in pixels, of the pixel that gets sampled as the background color for each scanline (default0, aka the leftmost pixel). use this when the image has a border so you can sample the actual background instead of the border. the offset must be smaller than the image width, periodt. β-s squaresizeβ set both the width and height of the input to squaresize pixels. this disables autosizing. two birds, one flag. ποΈ-w widthβ set the width, in pixels, of each input scanline. disables autosizing. π-n heightβ set the height, in scanlines, of the input. disables autosizing. (the program reads until end of file anyway, so this value chiefly serves to turn off autosizing β like, that's its whole job tbh.) π
π EXAMPLES π
π Example 1. Key out a rendered background and composite over a new one
rt -o image.pix model.g component.r
pixbgstrip -w 1024 -n 1024 image.pix > stripped.pix
pixmerge -g stripped.pix newbg.pix > composite.pix
A 1024x1024 image gets rendered with rt(1), its solid background color gets swapped to black by pixbgstrip, and then the result gets layered over a replacement backdrop with pixmerge(1) β whose -g option treats black as transparent β giving you a composite image. the whole glow-up pipeline fr fr π
π Example 2. Strip a slightly noisy bordered background
pixbgstrip -a -x 5 -t 4 frame.pix > clean.pix
The input size gets guessed automatically (-a), the background color gets sampled five pixels in from the left edge to skip a thin border (-x 5), and a threshold of 4 (-t 4) tolerates minor noise in the background. chef's kiss. π
π¦ SEE ALSO π¦
brlcad(1), pixbackgnd(1), pixmerge(1), pix-fb(1), fb-pix(1), pix(5) β go read them bestie, they're all part of the fam π
π DIAGNOSTICS π
If the input file is shorter than a whole number of scanlines, the trailing partial scanline gets discarded and the program exits. so like, that data's gone, no takebacks, be aware. π
π§ AUTHOR π§
BRL-CAD Team π«Ά
πΈ COPYRIGHT πΈ
This software is Copyright (c) 1991-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 β they genuinely want to hear about it, so like, don't be shy β¨
okay that's the whole page bestie, go strip some backgrounds πβ¨ππ¦ -- brought to you by BRL-CAD, and yes we're still here serving looks π π
π¦ 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