PIXCMP(1)

NAME

pixcmp - compare two pix image files pixel by pixel

SYNOPSIS

pixcmp [OPTIONS] FILE1 [FILE2 [SKIP1 [SKIP2]]]

DESCRIPTION

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:SKIP2

Skip 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).

RETURN VALUES

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.

EXAMPLES

pixcmp -d file1 file2

The two files are compared pixel by pixel with each difference printed instead of just the summary.

pixdiff file1.pix file2.pix | pixcmp - file3.pix

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

AUTHOR

BRL-CAD Team

This software is Copyright (c) 1989-2021 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