ColorTools
ReducePalette
reduce a large list of colors to a smaller, representative list
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
ReducePalette(colors)
colors
-
list of colors in formats recognized by ColorTools or a Palette object.
opts
(optional) equation(s) of the form option=value where option is either number or space
number=positive integer - maximum number of colors to return, 20 by default
space=string - the color space of the output color objects, "Lab" by default
This command reduces a large list of colors down to a small representative list of less than 20 colors.
with⁡ColorTools:
full≔seq⁡Color⁡RGB,1−i,i,1−i,i=0..1,0.05
full≔〈RGB : 1 0 1〉,〈RGB : 0.95 0.05 0.95〉,〈RGB : 0.9 0.1 0.9〉,〈RGB : 0.85 0.15 0.85〉,〈RGB : 0.8 0.2 0.8〉,〈RGB : 0.75 0.25 0.75〉,〈RGB : 0.7 0.3 0.7〉,〈RGB : 0.65 0.35 0.65〉,〈RGB : 0.6 0.4 0.6〉,〈RGB : 0.55 0.45 0.55〉,〈RGB : 0.5 0.5 0.5〉,〈RGB : 0.45 0.55 0.45〉,〈RGB : 0.4 0.6 0.4〉,〈RGB : 0.35 0.65 0.35〉,〈RGB : 0.3 0.7 0.3〉,〈RGB : 0.25 0.75 0.25〉,〈RGB : 0.2 0.8 0.2〉,〈RGB : 0.15 0.85 0.15〉,〈RGB : 0.1 0.9 0.1〉,〈RGB : 0.05 0.95 0.05〉,〈RGB : 0 1 0〉
numelems⁡full
21
reduced≔ReducePalette⁡full
reduced≔〈Lab : 56.4 91.1 -56.5〉,〈Lab : 60.3 98.3 -60.8〉,〈Lab : 49.5 55 -35.3〉,〈Lab : 51.3 74.8 -46.9〉,〈Lab : 50.2 29.1 -19.5〉,〈Lab : 53.4 0.00446 -0.00714〉,〈Lab : 58.6 -27.7 21.6〉,〈Lab : 65.1 -50.2 42.7〉,〈Lab : 72.3 -66.6 60.8〉,〈Lab : 85.8 -84.2 81.1〉,〈Lab : 80 -78 74.1〉
numelems⁡reduced
11
imgfile≔cat⁡kernelopts⁡datadir,/images/antennas.jpg:
ImageTools:-Embed⁡ImageTools:-Read⁡imgfile
full≔ColorsFromImage⁡imgfile:
226
reduced≔〈Lab : 62.8 -1.33 -14.4〉,〈Lab : 21.4 -0.302 11.1〉,〈Lab : 73.6 0.0941 24.9〉,〈Lab : 48.3 -1.06 10.5〉,〈Lab : 91.4 -0.834 2.85〉,〈Lab : 58.2 0.733 23.9〉,〈Lab : 78.1 -1.56 0.00854〉,〈Lab : 34.2 -0.502 10.3〉,〈Lab : 64.9 0.0325 7.04〉,〈Lab : 83.4 -1.77 9.21〉,〈Lab : 54.9 -1.49 -5.23〉,〈Lab : 71.3 -1.72 -5.04〉,〈Lab : 73.5 -1.44 6.35〉,〈Lab : 64.7 -1.15 -1.59〉,〈Lab : 56.9 -2.31 10.6〉,〈Lab : 40.7 -1.41 11.8〉,〈Lab : 67.3 1.03 25.1〉,〈Lab : 27.7 -0.271 12.1〉,〈Lab : 52.3 3.36 14.6〉,〈Lab : 60.4 -1.58 -6.56〉
reduced≔ReducePalette⁡full,number=8,space=RGB
reduced≔〈RGB : 0.49 0.573 0.667〉,〈RGB : 0.224 0.2 0.137〉,〈RGB : 0.776 0.703 0.53〉,〈RGB : 0.471 0.449 0.38〉,〈RGB : 0.907 0.905 0.882〉,〈RGB : 0.612 0.541 0.384〉,〈RGB : 0.745 0.761 0.757〉,〈RGB : 0.337 0.314 0.251〉
The ColorTools[ReducePalette] command was introduced in Maple 18.
For more information on Maple 18 changes, see Updates in Maple 18.
The ColorTools[ReducePalette] command was updated in Maple 2020.
The number and space options were introduced in Maple 2020.
For more information on Maple 2020 changes, see Updates in Maple 2020.
See Also
ColorTools/ColorSpaces
ColorTools:-Color
ColorTools:-ColorsFromImage
ColorTools:-Palette
ImageTools
Download Help Document