@drgd/aura
Version:
Extract color palettes from any image. Works on both server and client.
29 lines (26 loc) • 1.12 kB
TypeScript
import { AuraColor } from './index.js';
/**
* Extracts dominant colors from an image using server-side processing.
*
* Uses Sharp for image processing and combines median cut with k-means clustering.
* Includes automatic image scaling and optimization.
*
* @param imageUrlOrBuffer - URL of the image or a Buffer
* @param options - Configuration options
* @param options.paletteSize - Number of colors to extract (1-12)
* @param options.timeout - Maximum processing time in ms
* @param options.quality - Processing quality (low/medium/high)
* @param options.validateUrl - Whether to validate the image URL
* @param options.fallbackColors - Custom fallback colors
* @returns Promise resolving to array of AuraColor objects, sorted by dominance
* @throws {Error} When image processing fails
*/
declare function extractColors(imageUrlOrBuffer: string | Buffer, options?: {
paletteSize?: number;
timeout?: number;
maxSize?: number;
quality?: "low" | "medium" | "high";
validateUrl?: boolean;
fallbackColors?: AuraColor[];
}): Promise<AuraColor[]>;
export { extractColors as getAura };