PIXCOUNT(1)

πŸ“¦ version 7.44.0, in nixpkgs unstable

πŸ’… 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 byte
  • pix(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 is 3, matching standard pix(5) RGB data. use 1 for bw(5) grayscale, or 4 for 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 🫢


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