/** CLI / API 未指定 {@link ChooseBestRasterOptions.formatAllowlist} 时的默认额外候选格式 */ export declare const DEFAULT_FORMAT_ALLOWLIST_EXTENSIONS: readonly string[]; /** * 将 `webp`、`jpg`、`.png` 等待选格式标记转为带点扩展名并去重(jpeg/jpg 视为同一候选 `.jpg`)。 * 未知标记静默跳过。 */ export declare function normalizeFormatAllowlistTokens(tokens: string[]): string[]; export type ChooseBestRasterOptions = { /** * 参与优选的额外输出格式(`webp` / `.webp` 等均可,内部归一化)。 * 缺省:`webp` + `png`;传 `[]` 表示不做跨格式编码,仅同格式重压缩。 */ formatAllowlist?: string[] | null; }; /** * 在同格式重压缩与 allowlist 中的目标格式之间取体积最小的一种(固定质量预设)。 * 任一候选编码失败会被忽略。若无有效候选返回 null。 */ export declare function chooseBestRasterEncoding(input: Buffer, sameExt: string, maxWidth: number | null, opts?: ChooseBestRasterOptions): Promise<{ buffer: Buffer; outExt: string; } | null>; /** 同格式压缩 */ export declare function optimizeSameFormat(input: Buffer, ext: string, maxWidth: number | null): Promise; /** 编码为 webp */ export declare function encodeWebp(input: Buffer, maxWidth: number | null): Promise;