pixcmp [-b] [-s] [-d] [-q] [-i _SKIP_|_SKIP1:SKIP2_] [-n _COUNT_] _FILE1_ [_FILE2_ [_SKIP1_ [_SKIP2_]]]
PIXCMP(1)
NAME
pixcmp - compare two pix(5) format images pixel by pixel
On this page
SYNOPSIS
DESCRIPTION
pixcmp compares two pix(5) format images on a pixel-by-pixel basis and summarizes the differences. Because the comparison is per-pixel it is independent of image resolution. Each pixel is classified as matching, off by one when at least one channel differs and every channel is within +/-1, off by many when any channel differs by more than 1, or missing when the files differ in size. A one-line summary of these counts is printed to standard output.
With -b the files are instead compared byte by byte. Initial pixels (or bytes) may be discarded from either input, and the number of pixels (or bytes) compared may be limited; by default comparison runs to the end of the larger input.
If either FILE is - or is omitted, that input is read from standard input.
If both inputs are standard input, the two images' data must be interleaved.
Pixels and bytes are indexed linearly from one. Skip amounts may be given
either via -i or as the trailing positional SKIP1 and SKIP2 arguments.
OPTIONS
- -b
-
Iterate and report by bytes instead of by pixels. SKIP and COUNT values are then interpreted as bytes.
- -s
-
Print every pixel (or byte) whose values match.
- -d
-
Print every pixel (or byte) whose values differ.
- -q
-
Quiet. Suppress the header, the size-mismatch warning, and the summary line.
- -i SKIP
-
Discard the initial SKIP pixels (or bytes with -b) from both inputs.
- -i SKIP1:SKIP2
-
Discard the initial SKIP1 pixels (or bytes) from FILE1 and SKIP2 from FILE2.
- -n COUNT
-
Compare at most COUNT pixels (or bytes with -b). The default stops at end of file.
- -?, -h
-
Print a usage message and exit.
EXIT STATUS
- 0
-
No differences were found.
- 1
-
Every differing pixel is within +/-1 in each color channel. With -b, every differing byte differs by exactly 1.
- 2
-
At least one channel (or byte with -b) differs by more than 1, or an input value is missing.
EXAMPLES
rt -s512 moss.g all.g
pixcmp ref/moss.pix moss.pix
After ray tracing a scene with rt(1), compare the resulting pix(5) image against a known-good reference. This is the check the BRL-CAD benchmark uses to confirm that a build produces correct imagery; the exit status reflects whether any pixels differ.
pixcmp -d -i 1024 a.pix b.pix
Skip the first 1024 pixels of each input (for example a leading scanline or header region) and print each remaining pixel that differs, along with its RGB values from both files.
SEE ALSO
brlcad(1), rt(1), pixdiff(1), pix(5)
AUTHOR
BRL-CAD Team
COPYRIGHT
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