PIXCOUNT(1)
π PIXCOUNT(1) β the BRL-CAD girlies' pixel tallier π
okay so bestie, welcome to pixcount, section 1 of the BRL-CAD manual set β¨ this one's a whole vibe and honestly kind of a sleeper hit. buckle up π¦
πΈ NAME πΈ
pixcount β counts how many times each unique pixel color shows up in an image stream π like a census but for pixels, and every pixel gets counted, no cap.
β¨ SYNOPSIS β¨
pixcount [-#bytes_per_pixel] [infile.pix [outfile]]
that's it. that's the whole invocation. she's compact π
π«Ά DESCRIPTION π«Ά
okay so here's the tea β pixcount reads in a stream of pixels β 3-byte RGB by default, that's the standard β and tallies up how many times each unique color value appears. then it writes the result out sorted by color value π because we're organized in this house.
every output line is literally: the individual byte values of a pixel, followed by the number of times that pixel occurred in the input. so it's giving "here's the pixel, here's the receipts" π
file handling, since i know you're gonna ask:
- give it
infile.pixβ it reads from that file π - don't give it
infile.pixβ it reads from standard input π - also give it
outfileβ the tally gets written there π - don't give it
outfileβ the tally goes to standard output π¬
β οΈ also important: reading is refused when standard input is an interactive terminal. so don't just run it bare in your shell and expect magic, bestie, it will not play that game with you π
now the fun part β this tool is format-agnostic about pixel layout π§ setting the bytes-per-pixel lets it process literally whatever fixed-width pixel data you throw at it:
bw(5)grayscale β 1 bytepix(5)RGB β 3 bytes- RGBA β 4 bytes
- or any other fixed-width pixel data you feel like π
π OPTIONS π
-# bytes_per_pixelβ how many bytes make up exactly one pixel. must be a positive integer β the default is3, matching standardpix(5)RGB data. use1forbw(5)grayscale, or4for RGBA. that's the whole option. she's a one-trick pony and she ate π₯-h,-?β prints a usage message and exits. the classic "help me help you" move π
π EXAMPLES π
π Example 1. Find the most common colors in a rendered image
pixcount moss.pix | sort -k4 -n -r | head
tallies every unique RGB color in moss.pix, then pipes the whole thing through sort(1) so the ten most frequently occurring colors come out first π it's a quick way to snoop an image's palette or spot a dominant background color β genuinely iconic for debugging why your render looks like that π
π Example 2. Count grayscale levels in a BW image
pixcount -#1 image.bw levels.txt
treats the input as 1-byte-per-pixel bw(5) data and writes the count of each grayscale value to levels.txt β¨ revealing the image's tonal distribution. tonal distribution. say it with me. π¦
π₯ SEE ALSO π₯
brlcad(1), pixhist(1), pixstat(1), bw(5), pix(5) β go read the whole friend group, they're all slay π
π 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. periodt. π
π BUG REPORTS π
Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org π§ don't be shy, they wanna hear from you, ngl π§
and that's the page, bestie π this was pixcount(1) from the BRL-CAD fam β mwah, go count some pixels, you're gonna do great ππ
β¨
π¦ where this page comes from
- nixpkgs unstable: brlcad 7.44.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms