Skip to documentation
DocumentationAll documentsEnglish

PIXCOLORS(1)

NAME

pixcolors - count or list the distinct colors used in a pix image

On this page

SYNOPSIS

pixcolors [-v] [file.pix]

DESCRIPTION

pixcolors reads a pix(5) format image and writes to standard output the number of distinct color values it contains. The image is read from the named file.pix, or from standard input if no file is given. Each pixel is treated as a 24-bit RGB value, so the count ranges from 1 to 16,777,216.

OPTIONS

-v

Verbose. In addition to the color count, print a sorted list of every unique color used, one per line, as three decimal R G B component values.

EXAMPLES

Example 1. List the unique colors in a region of an image
pixrect -s 512 -w 64 -n 64 -x 100 -y 100 frame.pix | pixcolors -v

Extracts a 64x64 tile from a 512-line image with pixrect(1) and pipes it to pixcolors to print the count followed by every distinct R G B triple in that tile, which is useful for checking whether an area is a flat color or a gradient.

SEE ALSO

brlcad(1), pixrect(1), pixhist(1), pixstat(1), 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