/** * Image Metadata Service * Extracts EXIF metadata from images with GPS and privacy support */ export interface ImageMetadata { filePath: string; format: string; cameraMake?: string; cameraModel?: string; lensModel?: string; camera?: { make?: string; model?: string; lens?: string; }; dateTaken?: Date; iso?: number; focalLength?: number; aperture?: number; shutterSpeed?: string; exposureCompensation?: number; flash?: boolean; orientation?: number; width?: number; height?: number; resolution?: number; colorSpace?: string; hasGPS: boolean; latitude?: number; longitude?: number; altitude?: number; gpsTimestamp?: Date; gps?: { hasGPS: boolean; latitude?: number; longitude?: number; altitude?: number; }; hasEXIF?: boolean; hasThumbnail?: boolean; software?: string; dateModified?: Date; dateCreated?: Date; extractedAt: Date; } export interface ProgressUpdate { processed: number; total: number; currentFile?: string; currentStage?: "reading" | "extracting" | "caching"; errors: number; warnings: number; } export type ProgressCallback = (update: ProgressUpdate) => void; export interface ImageMetadataOptions { extractGPS?: boolean; stripGPS?: boolean; extractThumbnail?: boolean; concurrency?: number; onProgress?: ProgressCallback; useFileDate?: boolean; } export declare class ImageMetadataService { private readonly supportedFormats; /** * Format the image format name to standard uppercase */ private formatFormatName; /** * Get list of supported image formats */ getSupportedFormats(): string[]; /** * Check if an image file format is supported * @param filePath - The file path or filename to check * @returns true if the format is supported */ isFormatSupported(filePath: string): boolean; /** * Extract metadata from a single image file */ extract(filePath: string, options?: ImageMetadataOptions): Promise; /** * Extract metadata from multiple image files */ extractBatch(filePaths: string[], options?: ImageMetadataOptions): Promise; /** * Check if an image file contains GPS data */ hasGPS(filePath: string): Promise; /** * Create a copy of the image with GPS data stripped */ stripGPSData(filePath: string, outputPath?: string): Promise; /** * Strip GPS data from an image file (public method) * @param filePath - Source file path * @param outputPath - Optional output path (if different from source) * @returns Result object with success status and gpsRemoved flag */ stripGPS(filePath: string, outputPath: string): Promise<{ success: boolean; gpsRemoved: boolean; }>; /** * Strip all metadata from an image file * @param filePath - Source file path * @param outputPath - Optional output path (if different from source) * @returns Result object with success status */ stripAllMetadata(filePath: string, outputPath: string): Promise<{ success: boolean; }>; /** * Read image file into buffer */ private readImageFile; /** * Detect image format from magic bytes */ private detectImageFormat; /** * Check if magic bytes match */ private matchesMagic; /** * Get format from file extension */ private getFormatFromExtension; /** * Check if format is supported for detailed EXIF parsing */ private isDetailedParsingSupported; /** * Parse JPEG metadata including EXIF */ private parseJPEGMetadata; /** * Parse PNG metadata from IHDR chunk */ private parsePNGMetadata; /** * Check if JPEG has a thumbnail segment */ private hasThumbnailSegment; /** * Find EXIF segment in JPEG */ private findEXIFSegment; /** * Check TIFF byte order */ private isLittleEndian; /** * Parse an Image File Directory (IFD) */ private parseIFD; /** * Get string value from EXIF entry */ private getStringValue; /** * Get numeric value from EXIF entry */ private getNumericValue; /** * Get rational value from EXIF entry */ private getRationalValue; /** * Parse EXIF date string to Date object */ private parseEXIFDate; /** * Convert shutter speed value to readable string */ private convertShutterSpeed; /** * Parse GPS data from GPS IFD */ private parseGPSData; /** * Get array of rational values */ private getRationalArray; /** * Convert DMS (Degrees, Minutes, Seconds) to decimal degrees */ private convertDMSToDecimal; /** * Remove GPS data from JPEG buffer */ private removeGPSFromJPEG; /** * Remove all metadata (EXIF, IPTC, XMP, etc.) from JPEG buffer */ private removeAllMetadataFromJPEG; } export default ImageMetadataService; //# sourceMappingURL=image-metadata.service.d.ts.map