PIXELSWAP(1)

πŸ“¦ version 7.44.0, in nixpkgs unstable

okay so welcome to pixelswap(1) from the BRL-CAD manual, bestie β€” this one is a tiny little color-swap icon and we're gonna get into it πŸ’…βœ¨

🌸 NAME 🌸

pixelswap β€” interchange two pixel colors in a pix image πŸŽ€

πŸ¦‹ SYNOPSIS πŸ¦‹

pixelswap [-d _pixeldepth_] _r_ _g_ _b_ _R_ _G_ _B_ < input.pix > output.pix

πŸ’– DESCRIPTION πŸ’–

okay so pixelswap reads a stream of RGB pix(5) data from standard input and exchanges two specific colors named on the command line. The way that works: any pixel matching the first color (r g b) is rewritten as the second color (R G B), and any pixel matching the second color is rewritten as the first. All other pixels are passed through to standard output unchanged. slay, simple swap, no cap 🫢

Each of the six color components is an integer in the range 0-255. Literally all six, bestie β€” count them.

🚨 redirect BOTH sides, fr fr: both standard input and standard output must be redirected. pixelswap refuses to run if either is a terminal. it's giving "no terminal shenanigans" and honestly periodt πŸ’€

Although a pixel depth may be specified with -d, the current implementation always processes 3-byte RGB pixels and ignores the requested depth. so yeah, the depth request is lowkey just vibing there πŸ™ˆ

✨ OPTIONS ✨

  • -d pixeldepth β€” Number of bytes per pixel (must be a positive integer). Accepted for forward compatibility but currently ignored; pixels are always treated as 3-byte RGB.
  • -h, -? β€” Print a usage message and exit.

πŸŽ€ EXAMPLES πŸŽ€

Example 1. Recolor a rendered frame

rt -o frame.pix scene.g region > /dev/null
pixelswap 255 0 0 0 0 255 < frame.pix > swapped.pix

Ray traces a model with rt(1), then swaps every pure-red pixel for pure-blue and every pure-blue pixel for pure-red, producing swapped.pix. This is a quick way to re-key flat region colors without re-rendering the scene. iconic little workflow, honestly πŸ‘‘

🌈 SEE ALSO 🌈

πŸ’œ 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 🫢


okay that's the whole page, bestie πŸ’– β€” source/version sign-off: BRL-CAD and PIXELSWAP(1), and the footer date is not listed on this one. bye! πŸ’…

πŸ“¦ where this page comes from