Algosim documentation: ColorFreqs

ColorFreqs

Returns the colours and their frequencies in a pixmap.

Syntax

Description

ColorFreqs(pm) returns a list containing the individual colours and their (pixel) frequencies (counts) in pm. Each element in the result is a list '(c, n) where c is one of the distinct colours in pm and n the number of pixels in pm with this colour. The list is sorted by c with the most common colour first.

Examples

ExampleData("Sally")

Image 1

ColorFreqs(ans) \ 10
(rgba(0.996, 0.996, 0.996, 1.000), 981)
(rgba(1.000, 1.000, 1.000, 1.000), 706)
(rgba(0.992, 0.992, 0.992, 1.000), 276)
(rgba(0.055, 0.059, 0.039, 1.000), 213)
(rgba(0.059, 0.063, 0.039, 1.000), 183)
(rgba(0.059, 0.063, 0.043, 1.000), 173)
(rgba(0.055, 0.059, 0.035, 1.000), 165)
(rgba(0.063, 0.067, 0.043, 1.000), 164)
(rgba(0.051, 0.055, 0.035, 1.000), 163)
(rgba(0.063, 0.067, 0.047, 1.000), 162)

See also