/** * 支持的图片格式 */ export type SupportedFormat = 'jpeg' | 'jpg' | 'png' | 'webp' | 'avif' | 'tiff' | 'gif'; /** * 图片转换选项 */ export interface ConvertOptions { /** 输出质量 (1-100),仅对 JPEG、WebP、AVIF 有效 */ quality?: number; /** 是否保持透明度,仅对 PNG、WebP 有效 */ keepTransparency?: boolean; /** 输出宽度,保持宽高比 */ width?: number; /** 输出高度,保持宽高比 */ height?: number; /** 是否强制调整尺寸(不保持宽高比) */ forceResize?: boolean; /** 压缩级别 (0-9),仅对 PNG 有效 */ compressionLevel?: number; /** 是否渐进式编码,仅对 JPEG 有效 */ progressive?: boolean; } /** * 图片转换结果 */ export interface ConvertResult { /** 输入文件路径 */ inputPath: string; /** 输出文件路径 */ outputPath: string; /** 原始文件大小(字节) */ originalSize: number; /** 转换后文件大小(字节) */ convertedSize: number; /** 压缩率 */ compressionRatio: number; /** 转换耗时(毫秒) */ processingTime: number; } /** * 将图片转换为指定格式 * @param inputPath 输入图片路径 * @param outputPath 输出图片路径 * @param format 目标格式 * @param options 转换选项 * @returns 转换结果 */ export declare function convertImage(inputPath: string, outputPath: string, format: SupportedFormat, options?: ConvertOptions): Promise; /** * 批量转换图片格式 * @param files 文件列表,每个文件包含 inputPath, outputPath, format * @param options 转换选项 * @returns 转换结果列表 */ export declare function batchConvert(files: Array<{ inputPath: string; outputPath: string; format: SupportedFormat; }>, options?: ConvertOptions): Promise; /** * 获取图片信息 * @param imagePath 图片路径 * @returns 图片信息 */ export declare function getImageInfo(imagePath: string): Promise<{ path: string; format: keyof import("sharp").FormatEnum; width: number; height: number; size: number; hasAlpha: boolean; density: number | undefined; space: keyof import("sharp").ColourspaceEnum; channels: import("sharp").Channels; depth: keyof import("sharp").DepthEnum; }>; /** * 创建缩略图 * @param inputPath 输入图片路径 * @param outputPath 输出缩略图路径 * @param width 缩略图宽度 * @param height 缩略图高度 * @param format 输出格式 * @param options 转换选项 * @returns 转换结果 */ export declare function createThumbnail(inputPath: string, outputPath: string, width: number, height: number, format?: SupportedFormat, options?: ConvertOptions): Promise;