ReducePalette - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


ColorTools

  

ReducePalette

  

reduce a large list of colors to a smaller, representative list

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

ReducePalette(colors)

Parameters

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

Options

• 

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

Description

• 

This command reduces a large list of colors down to a small representative list of less than 20 colors.

Examples

> 

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⟩

(1)
> 

numelems⁡full

21

(2)
> 

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⟩

(3)
> 

numelems⁡reduced

11

(4)
> 

imgfile≔cat⁡kernelopts⁡datadir,/images/antennas.jpg:

> 

ImageTools:-Embed⁡ImageTools:-Read⁡imgfile

> 

full≔ColorsFromImage⁡imgfile:

> 

numelems⁡full

226

(5)
> 

reduced≔ReducePalette⁡full

reduced≔⟨Lab : 59 -1.54 -15⟩,⟨Lab : 21.4 -0.302 11.1⟩,⟨Lab : 91 -1.18 4.78⟩,⟨Lab : 61.1 1.37 25.1⟩,⟨Lab : 40.7 -1.41 11.8⟩,⟨Lab : 76.5 -2.01 11.7⟩,⟨Lab : 70.9 -1.52 -4.01⟩,⟨Lab : 50.5 -0.931 6.44⟩,⟨Lab : 50.7 -1.82 -4.97⟩,⟨Lab : 64.9 0.0325 7.04⟩,⟨Lab : 73.6 0.0941 24.9⟩,⟨Lab : 52 1.21 23.4⟩,⟨Lab : 78.1 -1.56 0.00854⟩,⟨Lab : 60.2 -2.1 -2.33⟩,⟨Lab : 83.9 -1.37 8.78⟩,⟨Lab : 58 -0.573 10.6⟩,⟨Lab : 65 -0.618 -8.3⟩,⟨Lab : 34.2 -0.502 10.3⟩,⟨Lab : 27.7 -0.271 12.1⟩,⟨Lab : 68 1.28 25.2⟩

(6)
> 

reduced≔ReducePalette⁡full,number=8,space=RGB

reduced≔⟨RGB : 0.529 0.577 0.631⟩,⟨RGB : 0.224 0.2 0.137⟩,⟨RGB : 0.905 0.9 0.863⟩,⟨RGB : 0.694 0.62 0.451⟩,⟨RGB : 0.397 0.376 0.301⟩,⟨RGB : 0.549 0.478 0.329⟩,⟨RGB : 0.745 0.761 0.757⟩,⟨RGB : 0.743 0.72 0.643⟩

(7)

Compatibility

• 

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

ColorTools/ColorSpaces

ColorTools:-Color

ColorTools:-ColorsFromImage

ColorTools:-Palette

ImageTools