BWDIFF(1)

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

πŸ’… bwdiff(1) β€” the bestie guide to black-and-white file diffing πŸ’…

🌸 NAME 🌸

bwdiff β€” compare two black and white files. That’s it, that’s the name, and it’s iconic. ✨

πŸ“Έ SYNOPSIS πŸ“Έ

bwdiff [-b] [-m | -g | -l | -e | -n] file1 file2

🫢 DESCRIPTION 🫢

Okay so bwdiff compares two black and white bw(5) format files and writes the results to standard output. By default, bwdiff records the differences as offsets from a neutral, half-intensity grey (128). The written value is brighter than this neutral grey by an amount proportional to the signed difference between the pixels in file1 and file2. Pixels that are brighter in file1 than in file2 will be brighter than the neutral grey, while pixels that are dimmer in file1 than in file2 will be dimmer. This difference is divided by two to fit the 0 to 255 output range. Math but make it pixel drama, fr fr. πŸ’…

bwdiff also accepts - as a synonym for standard input, and . as a synonym for the platform’s null device. Lowkey handy, highkey slay. πŸ¦‹

Note that this program also produces useful results on color pix(5) files. Not me being multifunctional. 🌈

✨ OPTIONS ✨

  • -m β€” calculates the magnitude of the difference. No offset or division is applied. Brighter pixels indicate larger differences in value, and black indicates no difference. It’s giving pure difference energy. πŸ”₯
  • -g β€” greater-than relational operation. Outputs a full-white (255) pixel if the value of the pixel in file1 is greater than the corresponding pixel in file2. Cannot be combined with other relational flags. Pick one relational flag, bestie β€” no chaotic polycule of flags. πŸ™ˆ
  • -l β€” less-than relational operation. Outputs a full-white (255) pixel if the value of the pixel in file1 is less than the corresponding pixel in file2. Cannot be combined with other relational flags. Periodt. πŸ’…
  • -e β€” equal-to relational operation. Outputs a full-white (255) pixel if the value of the pixel in file1 is equal to the corresponding pixel in file2. Cannot be combined with other relational flags. Matchy-matchy but make it Unix. πŸŽ€
  • -n β€” not-equal-to relational operation. Outputs a full-white (255) pixel if the value of the pixel in file1 is not equal to the corresponding pixel in file2. Cannot be combined with other relational flags. The β€œwe are not the same” flag, literally. πŸ’€
  • -b β€” sets the background to the corresponding pixels of file1 at a lowered intensity instead of the default black background. This option only applies when using one of the relational operation flags (-g, -l, -e, or -n). So don’t try it solo, iykyk. 🫢

πŸŽ€ EXAMPLES πŸŽ€

🌟 Example 1. Basic Difference 🌟

To find the difference between two black and white images:

bwdiff image1.bw image2.bw > diff.bw

🌟 Example 2. Relational Operation on Color Images 🌟

Suppose you ran pixstat(1) on a file and found the modes to be red=107, green=93, blue=70. You can display those pixels whose colors are exactly at these values by comparing the file against a solid color stream:

gencolor 107 93 70 | bwdiff -e file.pix - | pix-fb

🌈 SEE ALSO 🌈

Go read these, bestie, iykyk:

πŸ‘‘ AUTHOR πŸ‘‘

BRL-CAD Team β€” iconic, fr fr. πŸ‘‘

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. Please do that, bestie β€” bug reports are self-care. πŸ›πŸ’–

BRL-CAD Β· bwdiff(1) Β· source/version sign-off, bestie β€” no date in the footer, so no invented date, periodt πŸ’–

πŸ“¦ where this page comes from