A picture reduced to a small palette.
{reduced, palette} = Linocut.Quantise.reduce(raster, 16)The palette is chosen by median cut over the picture's opaque pixels and every pixel is then moved to its nearest entry. A pixel whose alpha is under the threshold stays clear and takes no palette entry.
Summary
Functions
The entry of palette closest to colour.
At most count colours chosen from raster's opaque pixels, darkest first.
raster with at most count colours, and the palette it was given.
raster with every opaque pixel moved to its nearest entry in palette.
Types
Functions
The entry of palette closest to colour.
@spec palette(FrenchCurve.Raster.t(), pos_integer(), keyword()) :: [colour()]
At most count colours chosen from raster's opaque pixels, darkest first.
Options
:alpha— the alpha at or above which a pixel counts as opaque. Default128
@spec reduce(FrenchCurve.Raster.t(), pos_integer(), keyword()) :: {FrenchCurve.Raster.t(), [colour()]}
raster with at most count colours, and the palette it was given.
Options
:alpha— the alpha at or above which a pixel counts as opaque. Default128
@spec to_palette(FrenchCurve.Raster.t(), [colour()], keyword()) :: FrenchCurve.Raster.t()
raster with every opaque pixel moved to its nearest entry in palette.
Options
:alpha— the alpha at or above which a pixel counts as opaque. Default128