/**
 * Image Optimizer Service
 *
 * TypeScript wrapper for Python image optimizer providing:
 * 1. Resize for OCR processing (max 4800px width)
 * 2. Resize for VLM (optimize token usage, max 2048px)
 * 3. Relevance analysis to filter logos, icons, and decorative elements
 *
 * The relevance analysis uses multi-layer heuristics:
 * - Size filtering (tiny images are likely icons)
 * - Aspect ratio analysis (extreme ratios = banners/logos)
 * - Color diversity (low color count = likely logo/icon)
 */
/**
 * Image category classification
 */
type ImageCategory = 'photo' | 'chart' | 'document' | 'logo' | 'icon' | 'decorative' | 'unknown';
/**
 * Result of image relevance analysis
 */
interface ImageAnalysisResult {
    success: true;
    path: string;
    width: number;
    height: number;
    aspect_ratio: number;
    unique_colors: number;
    color_diversity_score: number;
    size_score: number;
    aspect_score: number;
    overall_relevance: number;
    predicted_category: ImageCategory;
    should_vlm: boolean;
    skip_reason?: string;
}
/**
 * Result of resize operation
 */
interface ResizeResult {
    success: true;
    resized: boolean;
    original_width: number;
    original_height: number;
    output_width: number;
    output_height: number;
    scale_factor?: number;
    output_path: string;
}
/**
 * Result when image is skipped (too small)
 */
interface SkipResult {
    success: true;
    skipped: true;
    skip_reason: string;
    original_width: number;
    original_height: number;
}
/**
 * Error result from Python script
 */
interface ErrorResult {
    success: false;
    error: string;
}
/**
 * Configuration for the image optimizer
 */
interface ImageOptimizerConfig {
    /** Path to Python executable */
    pythonPath: string;
    /** Timeout in milliseconds */
    timeout: number;
    /** Maximum dimension for VLM resize (default: 2048) */
    vlmMaxDimension: number;
    /** Minimum size to skip for VLM (default: 50) */
    vlmSkipBelowSize: number;
    /** Minimum relevance score for VLM (default: 0.3) */
    minRelevanceScore: number;
}
/**
 * Service for optimizing images for OCR and VLM processing
 */
export declare class ImageOptimizer {
    private readonly config;
    private readonly scriptPath;
    constructor(config?: Partial<ImageOptimizerConfig>);
    /**
     * Analyze an image to determine if it should be processed by VLM.
     *
     * Uses multi-layer heuristics:
     * 1. Size (tiny images = skip)
     * 2. Aspect ratio (extreme ratios = skip)
     * 3. Color diversity (low = likely logo/icon)
     * 4. Category prediction
     *
     * @param imagePath - Path to the image file
     * @returns Analysis result with should_vlm recommendation
     */
    analyzeImage(imagePath: string): Promise<ImageAnalysisResult | ErrorResult>;
    /**
     * Resize an image for VLM processing (Chandra).
     *
     * @param inputPath - Path to input image
     * @param outputPath - Path for output (optional, creates temp file if not provided)
     * @returns Resize result or skip result if too small
     */
    resizeForVLM(inputPath: string, outputPath?: string): Promise<ResizeResult | SkipResult | ErrorResult>;
    /**
     * Check if the Python optimizer script exists.
     */
    isAvailable(): boolean;
    /**
     * Create a temporary file path for resized output.
     */
    private createTempPath;
    /**
     * Run the Python optimizer script.
     * M-14: Sends SIGKILL after 5s if SIGTERM from Node.js timeout didn't terminate the process.
     */
    private runPython;
}
/**
 * Get an optimizer instance.
 * When config is provided, always creates a new instance and updates the cache.
 * When no config is provided, returns the cached instance (creating one if needed).
 */
export declare function getImageOptimizer(config?: Partial<ImageOptimizerConfig>): ImageOptimizer;
export {};
//# sourceMappingURL=optimizer.d.ts.map