pixcmp — compare two pix image files pixel by pixel
pixcmp is a program to compare two BRL-CAD pix image files pixel by pixel (or byte by byte), optionally skipping initial pixels (or bytes) in one or both input files. The following OPTIONS are available:
-b
Use bytes instead of pixels for both processing and output.
This can be useful for comparing BW images or other data files.
With this option, the -i
SKIP values should be
specified as bytes instead of pixels.
-s
Output a line per pixel (or per byte if using the
-b
option) where the values are the same. Each
line includes the pixel (or byte) number counting from 1, the
respective input values, and a label.
-d
Output a line per pixel (or per byte if using the
-b
option) where the values are different. Each
line includes the pixel (or byte) number counting from 1, the
respective input values, and a label.
-q
Be more quiet, suppressing additional printing typically
sent to standard error. With the -s
and/or
-d
options, respective lines will still be
printed to standard output, but without header and summary
information getting sent to standard error.
This option has no affect on error printing that can result during abnormal exit of pixcmp.
-i
SKIP
Skip the first SKIP pixels (or bytes if using the -b
option) of input for FILE1 and FILE2.
-i
SKIP1
:SKIP2Skip the first SKIP1 pixels (or bytes if using the
-b
option) of FILE1 and first SKIP2 pixels in
FILE2.
SKIP1 and SKIP2 are the number of pixels (or bytes if using the
-b
option) to skip in each file.
If FILE is `-` or missing, pixcmp reads from the standard input. If FILE1 and FILE2 are both standard input, then values must be interleaved (e.g., r1r2g1g2b1b2r1r2g1g2b1b2...etc... for r1g1b1 and r2g2b2 from two separate input streams).
The pixcmp utility returns
0
if there are no differences, 1
if there are only off-by-one differences, 2
if
there are off-by-many errors, 126
if there are file
processing problems, and 127
if there are argument
processing or usage errors.
pixcmp -d file1 file2
The two files are compared pixel by pixel with each difference printed instead of just the summary.
The pixdiff tool compares the pixels in file1.pix with those in file2.pix and then outputs a resulting `diff` image which is then processed by pixcmp as input and compared against file3.pix, reporting on the differences.
echo -n "aabcddeg" | pixcmp -b -s -d - -
Here, pixcmp reads interleaved data from the system echo command (-n avoids a trailing newline) provided via standard input. For each pair of characters (i.e., bytes), it reports their status:
#Byte FILE1 FILE2 LABEL
1 97 97 MATCHING
2 98 99 OFF_BY_ONE
3 100 100 MATCHING
4 101 103 OFF_BY_MANY
pixcmp bytes: 2 matching, 1 off by 1, 1 off by many