ImageBufAlgo::color_count() and oiiotool --colorcount
Both can be used to count how many pixels match a given color or colors.
ImageBufAlgo::color_range_check and oiiotool --rangecheck
Both can be used to count how many pixels have values that fall outside
the specified range.