identify -verbose provides a palette histogram table, but only if the number of unique colors is below a limit (1024 in the versions I've checked, v6.x up to v6.8.3).
Instead you can just "
convert" your image to a histogram, this output is not limited by number of unique colors:
convert image.jpg -format %c -depth 8 histogram:info:histogram_image.txt
sort -n histogram_image.txt | tail -1
Sorting the output numerically by the first column sorts by frequency of pixel colors. (Frequency of specific colour pixels might not correspond to a human perception of predominant color of course.)
If you're reducing colors, you can probably just trust
convert to do it for you by your choice of dithering and/or posterizing. Even specifically to the web-safe 216:
convert image.png +dither -remap netscape: image_websafe.png
You would probably get closer to a perceived predominant color by some combination of blurring, resizing and posterizing, this is not a simple problem to define and solve: