pixclump [-c _R/G/B_] [-f _color_file_] [-x _debug_flags_] [infile.pix [outfile.pix]]
PIXCLUMP(1)
NAME
pixclump - quantize the colors in a pix(5) stream to a specified set
On this page
SYNOPSIS
DESCRIPTION
pixclump reads an input stream of pix(5) data, replaces each pixel with the most similar color from a specified set, and writes out the quantized pixels.
The set of colors may be specified either on the command line, with one -c option per color, or in a file named with the -f option. Each pixel in the input is compared against every color in the set and replaced on output by the nearest one, where distance is the sum of the squares of the differences in the red, green, and blue channels.
If no input file is named, pixclump reads from standard input; if no output file is named, it writes to standard output. A typical use is renormalizing an image: when a tool such as pixscale(1) interpolates new colors into an image that originally held only a few, pixclump maps the interpolated pixels back onto the original palette.
OPTIONS
- -c R/G/B
-
Add a single color to the set, specified as a slash-separated red/green/blue triple. May be given multiple times to build up the set. Using -c discards any color file previously named with -f.
- -f color_file
-
Read the color set from color_file, one R/G/B color per line. Blank lines and lines beginning with '#' are ignored. Using -f discards any colors previously given with -c.
- -x debug_flags
-
Enable diagnostic output. debug_flags is a hexadecimal bit mask: 0x01 prints the color table, 0x02 traces best-match selection, and 0x04 traces pixel output.
- -h, -?
-
Print a usage message and exit.
EXAMPLES
pixclump -c 0/0/0 -c 255/255/255 -c 255/0/0 -c 0/0/255 in.pix > out.pix
Quantizes every pixel of in.pix to the nearest of black, white, red, or blue and writes the result to out.pix.
pixscale -s 512 -w 256 -n 256 orig.pix | pixclump -f palette.txt > fixed.pix
After pixscale(1) interpolates new intermediate colors while resizing, this maps each pixel back onto the original palette listed in palette.txt, restoring the limited color set.
SEE ALSO
brlcad(1), pixscale(1), pix-bw(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