Skip to documentation
DocumentationAll documentsEnglish

PIXDIFF(1)

NAME

pixdiff - highlight differences between two pix or bw images

On this page

SYNOPSIS

pixdiff _file1.pix_ _file2.pix_ > _out.pix_
pixdiff -b _file1.bw_ _file2.bw_ > _out.bw_

DESCRIPTION

By default, pixdiff compares raw pix(5) images as RGB pixels and writes a PIX difference image to standard output. When all three channels of a pixel match, it writes a dim grayscale version of that pixel to all three output channels. When any channel differs, each matching channel is written as zero, each channel differing by one is written as 192, and each channel differing by more than one is written as 255.

With -b, pixdiff compares raw bw(5) images one byte at a time and writes a BW difference image. Differing samples use the same 192 and 255 intensities; matching samples are written at half their original intensity.

No image dimensions are needed. The two inputs must be the same size in bytes, and PIX input must contain complete three-byte pixels. Otherwise, pixdiff reports an error. Either input file may be given as - to read from standard input. Output must be redirected; pixdiff refuses to write a raw image stream to a terminal.

Upon completion, pixdiff reports matching, off-by-one, and larger-difference channel or sample counts on standard error.

bwdiff -n -b produces a similar BW highlight image, but writes 255 rather than 192 for off-by-one differences. The default bwdiff(1) output instead shows signed differences around a neutral gray.

OPTIONS

-b

Treat both inputs and the output as one-byte-per-pixel BW images. Without this option, use three-byte-per-pixel PIX images.

-h

Show usage information.

EXAMPLES

Example 1. Diff two renderings and view the result
pixdiff frame_a.pix frame_b.pix > diff.pix
pix-png -w 512 -n 512 diff.pix > diff.png

Compares two 512x512 renderings, writing a highlight image to diff.pix, then converts it to PNG with pix-png(1) for easy viewing. Differing channels glow brightly against a dim grayscale backdrop, making changed regions easy to spot. The matching/off-by-1/off-by-many byte counts printed on standard error give a quick quantitative sense of how much changed.

Example 2. Diff two grayscale images
pixdiff -b depth_a.bw depth_b.bw > depth_diff.bw

Writes a grayscale highlight image using byte-wise comparison. Matching samples retain half their input intensity as context.

SEE ALSO

brlcad(1), bwdiff(1), pix-fb(1), pix-png(1), pixstat(1), bw(5), pix(5)

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