/** * Color quantization using the median cut algorithm * * This module provides functions to reduce the number of colors in an image * to fit within GIF's 256 color palette limitation. */ import { RGBColor, ImageData, IndexedImage } from './types.js'; /** * Color quantizer using median cut algorithm */ export declare class MedianCutQuantizer { private readonly maxColors; private palette; private colorMap; constructor(maxColors?: number); /** * Quantizes an image to the specified number of colors */ quantize(imageData: ImageData): IndexedImage; /** * Gets the current palette as RGB colors */ getPalette(): RGBColor[]; /** * Gets the current palette as Uint8Array (RGB triplets) */ getPaletteData(): Uint8Array; /** * Maps a color to its closest palette index */ mapColor(color: RGBColor): number; /** * Builds the color mapping from cubes */ private buildColorMap; /** * Converts image data to indexed format */ private convertToIndexed; } /** * Convenience function to quantize an image */ export declare function quantizeImage(imageData: ImageData, maxColors?: number): IndexedImage;