/** Controls how image files are processed when read. */
export type ImageMode = 'default' | 'unoptimized' | 'metadata-only' | 'thumbnail-only';
/**
 * Resize target (max edge in px) per ImageMode.
 * null means no resizing (either no image data at all, or full resolution).
 */
export declare const RESIZE_TARGETS: Record<ImageMode, number | null>;
export declare const IMAGE_SIZE_LIMIT: number;
export declare const IMAGE_EXTENSIONS: Set<string>;
export declare const IMAGE_MEDIA_TYPES: Record<string, string>;
export declare const ARCHIVE_EXTENSIONS: Set<string>;
/**
 * Validate that the file's magic bytes match the expected extension.
 * If they don't match, attempts to detect the actual type.
 */
export declare function validateMagicBytes(buffer: Buffer, ext: string): {
    valid: boolean;
    detectedType?: string;
};
/** Returns true when the extension belongs to a supported image format. */
export declare function isImageFile(ext: string): boolean;
/** Returns true when the extension belongs to a supported archive format. */
export declare function isArchiveFile(ext: string): boolean;
/** Returns the MIME type for an image extension, or null if unknown. */
export declare function getImageMediaType(ext: string): string | null;
export interface ImageMetadata {
    width?: number;
    height?: number;
    format: string;
    fileSize: number;
}
/**
 * Extract basic image metadata from a buffer.
 * Supports PNG, JPEG, GIF, BMP. Returns format + fileSize for others.
 */
export declare function getImageMetadata(buffer: Buffer, ext: string): ImageMetadata;
/**
 * Minimal sharp interface covering only the operations used here.
 * Avoids requiring @types/sharp or the sharp package to be installed.
 */
interface SharpInstance {
    metadata(): Promise<{
        width?: number;
        height?: number;
        format?: string;
    }>;
    resize(options: {
        width?: number;
        height?: number;
    }): SharpInstance;
    png(): SharpInstance;
    jpeg(): SharpInstance;
    toBuffer(options: {
        resolveWithObject: true;
    }): Promise<{
        data: Buffer;
        info: {
            width: number;
            height: number;
        };
    }>;
    toBuffer(): Promise<Buffer>;
}
type SharpFactory = (input: Buffer) => SharpInstance;
/**
 * Lazy-load sharp.
 * Returns the sharp factory function on success, null if unavailable.
 */
export declare function tryLoadSharp(): Promise<SharpFactory | null>;
export interface ResizeResult {
    buffer: Buffer;
    resized: boolean;
    width?: number;
    height?: number;
}
/**
 * Resize an image buffer so its longest edge is ≤ maxEdge.
 * If sharp is unavailable or the image is already small enough, returns the original.
 *
 * @remarks
 * Format conversion notes (intentional for LLM consumption):
 * - WebP input is converted to PNG (losing WebP compression efficiency), since
 *   sharp's resize pipeline outputs JPEG or PNG only.
 * - GIF input loses animation — only the first frame is preserved.
 * - These trade-offs are intentional: LLMs expect static raster images.
 */
export declare function resizeImage(buffer: Buffer, mediaType: string, maxEdge: number): Promise<ResizeResult>;
export interface ConvertResult {
    buffer: Buffer;
    mediaType: string;
    converted: boolean;
    originalFormat: string;
}
/**
 * Convert non-portable image formats (BMP, TIFF, AVIF) to PNG using sharp.
 * Returns the original buffer if sharp is unavailable or the format doesn't need conversion.
 */
export declare function convertToPortableFormat(buffer: Buffer, ext: string): Promise<ConvertResult>;
export declare function humanSize(bytes: number): string;
/**
 * List the contents of an archive file.
 * Supports ZIP, .gz (gunzip + tar parse if tar), .tar, .tgz.
 */
export declare function listArchiveContents(resolvedPath: string, buffer: Buffer, ext: string): string;
/**
 * Detect binary content by scanning for null bytes in the first sampleSize bytes.
 * Returns true if null bytes are found (indicating binary content).
 */
export declare function isBinaryByContent(buffer: Buffer, sampleSize?: number): boolean;
export {};
//# sourceMappingURL=media.d.ts.map