Class QuantizerUtilities
Contains utility methods for IQuantizer<TPixel> instances.
Inherited Members
Namespace: SixLabors.ImageSharp.Processing.Processors.Quantization
Assembly: SixLabors.ImageSharp.dll
Syntax
public static class QuantizerUtilitiesMethods
| Improve this Doc View SourceBuildPaletteAndQuantizeFrame<TPixel>(IQuantizer<TPixel>, ImageFrame<TPixel>, Rectangle)
Execute both steps of the quantization.
Declaration
public static IndexedImageFrame<TPixel> BuildPaletteAndQuantizeFrame<TPixel>(this IQuantizer<TPixel> quantizer, ImageFrame<TPixel> source, Rectangle bounds)
    where TPixel : struct, IPixel<TPixel>Parameters
| Type | Name | Description | 
|---|---|---|
| IQuantizer<TPixel> | quantizer | The pixel specific quantizer. | 
| ImageFrame<TPixel> | source | The source image frame to quantize. | 
| Rectangle | bounds | The bounds within the frame to quantize. | 
Returns
| Type | Description | 
|---|---|
| IndexedImageFrame<TPixel> | A IndexedImageFrame<TPixel> representing a quantized version of the source frame pixels. | 
Type Parameters
| Name | Description | 
|---|---|
| TPixel | The pixel type. | 
CheckPaletteState<TPixel>(in ReadOnlyMemory<TPixel>)
Helper method for throwing an exception when a frame quantizer palette has been requested but not built yet.
Declaration
public static void CheckPaletteState<TPixel>(in ReadOnlyMemory<TPixel> palette)
    where TPixel : struct, IPixel<TPixel>Parameters
| Type | Name | Description | 
|---|---|---|
| ReadOnlyMemory<TPixel> | palette | The frame quantizer palette. | 
Type Parameters
| Name | Description | 
|---|---|
| TPixel | The pixel format. | 
Exceptions
| Type | Condition | 
|---|---|
| InvalidOperationException | The palette has not been built via AddPaletteColors(Buffer2DRegion<TPixel>) | 
QuantizeFrame<TFrameQuantizer, TPixel>(ref TFrameQuantizer, ImageFrame<TPixel>, Rectangle)
Quantizes an image frame and return the resulting output pixels.
Declaration
public static IndexedImageFrame<TPixel> QuantizeFrame<TFrameQuantizer, TPixel>(ref TFrameQuantizer quantizer, ImageFrame<TPixel> source, Rectangle bounds)
    where TFrameQuantizer : struct, IQuantizer<TPixel> where TPixel : struct, IPixel<TPixel>Parameters
| Type | Name | Description | 
|---|---|---|
| TFrameQuantizer | quantizer | The pixel specific quantizer. | 
| ImageFrame<TPixel> | source | The source image frame to quantize. | 
| Rectangle | bounds | The bounds within the frame to quantize. | 
Returns
| Type | Description | 
|---|---|
| IndexedImageFrame<TPixel> | A IndexedImageFrame<TPixel> representing a quantized version of the source frame pixels. | 
Type Parameters
| Name | Description | 
|---|---|
| TFrameQuantizer | The type of frame quantizer. | 
| TPixel | The pixel format. |