import type { CanvasLike, ImageDataLike } from "./dither/dither"; export type ImageStyle = "photo" | "illustration" | "unknown"; export type ImageKind = "photo" | "lowContrastPhoto" | "highContrastPhoto" | "flatIllustration" | "lineArt" | "textOrUi" | "pixelArt" | "unknown"; export interface ImageStyleMetrics { sampleCount: number; uniqueColorRatio: number; topColorCoverage: number; paletteEntropy: number; flatRatio: number; softChangeRatio: number; strongEdgeRatio: number; edgeDensity: number; horizontalEdgeRatio: number; verticalEdgeRatio: number; lumaStdDev: number; lumaP05: number; lumaP95: number; lumaRange: number; saturationMean: number; saturationStdDev: number; darkRatio: number; lightRatio: number; grayRatio: number; highSaturationRatio: number; warmPaperRatio: number; redRatio: number; darkNeutralRatio: number; photoTileRatio: number; flatTileRatio: number; textTileRatio: number; gradientTileRatio: number; transparentRatio: number; } export interface ImageStyleClassification { style: ImageStyle; kind: ImageKind; kindScores: Record; confidence: number; photoScore: number; metrics: ImageStyleMetrics; } export interface ClassifyImageStyleOptions { /** * Longest side of the internal sample grid. Larger values are slower but can * preserve more detail for tiny repeated patterns. */ maxSampleDimension?: number; /** Pixels at or below this alpha value are ignored. */ transparentAlphaThreshold?: number; /** * Decision threshold for `photoScore`. Raise it to classify ambiguous images * as illustrations more often, lower it to classify them as photos more often. */ photoThreshold?: number; } /** * Heuristically classify image data as a photo or an illustration. * * This does not use ML. It looks for signals that usually separate photos from * illustrations: color diversity, soft tonal changes, flat-color regions, edge * density, and saturation/luminance variation. */ export declare function classifyImageStyle(image: ImageDataLike, options?: ClassifyImageStyleOptions): ImageStyleClassification; export declare function classifyCanvasImageStyle(canvas: CanvasLike, options?: ClassifyImageStyleOptions): ImageStyleClassification; export declare function isPhotoImage(image: ImageDataLike, options?: ClassifyImageStyleOptions): boolean; export declare function isIllustrationImage(image: ImageDataLike, options?: ClassifyImageStyleOptions): boolean;