/** * Image - PDF image handling * * This module provides 100% API compatibility with MicroPDF's image operations. * Handles image loading, decoding, and format conversion. */ import { Colorspace } from './colorspace.js'; import { Pixmap } from './pixmap.js'; /** * Image orientation (EXIF orientation) */ export declare enum ImageOrientation { Normal = 0, /** Alias for Normal */ Identity = 0, FlipH = 1, /** Alias for FlipH */ FlipX = 1, Rotate180 = 2, FlipV = 3, /** Alias for FlipV */ FlipY = 3, Transpose = 4, Rotate90 = 5, Transverse = 6, Rotate270 = 7 } /** * A PDF image */ export declare class Image { private _ctx?; private _image?; private _width; private _height; private _xres; private _yres; private _colorspace; private _isMask; private _hasAlpha; private _bpp; private _orientation; private _refCount; private _data; constructor(width: number | null, _height?: number, _colorspace?: Colorspace, _options?: { xres?: number; yres?: number; isMask?: boolean; hasAlpha?: boolean; bpp?: number; orientation?: ImageOrientation; data?: Uint8Array; }); /** * @internal Check if FFI bindings are available */ get hasNativeHandle(): boolean; /** * Create image from pixmap */ static createFromPixmap(pixmap: Pixmap): Image; /** * Create image from raw data */ static createFromData(width: number, height: number, colorspace: Colorspace, data: Uint8Array, options?: { xres?: number; yres?: number; isMask?: boolean; hasAlpha?: boolean; }): Image; /** * Create image from file using FFI * @throws Error when native bindings are not available */ static createFromFile(path: string): Image; /** * Create image from buffer using FFI * @throws Error when native bindings are not available */ static createFromBuffer(buffer: Uint8Array): Image; keep(): this; drop(): void; /** * Clone this image */ clone(): Image; get width(): number; get height(): number; get xres(): number; get yres(): number; get colorspace(): Colorspace; isMask(): boolean; hasAlpha(): boolean; get bpp(): number; get orientation(): ImageOrientation; set orientation(orientation: ImageOrientation); get data(): Uint8Array; getWidth(): number; getHeight(): number; getXRes(): number; getYRes(): number; getColorspace(): Colorspace | null; getBpp(): number; getOrientation(): ImageOrientation; /** * Decode image to pixmap */ getPixmap(_subarea?: unknown, _ctm?: unknown, _l2factor?: unknown, _cookie?: unknown): Pixmap | null; /** * Decode image to pixmap (alias for getPixmap) */ decode(_subarea?: unknown, _ctm?: unknown): Pixmap | null; /** * Decode image to pixmap with scaling * @note Returns blank pixmap until FFI bindings perform actual scaling */ decodeScaled(_subarea?: unknown, width?: number, height?: number, _cookie?: unknown): Pixmap | null; /** * Decode image to pixmap with scaling (original method) */ getPixmapScaled(width: number, height: number): Pixmap | null; /** * Check if image is valid */ isValid(): boolean; /** * Get image size in bytes */ getSize(): number; /** * Get stride (bytes per row) */ getStride(): number; /** * Get number of components */ getComponentCount(): number; /** * Get image info */ getInfo(): ImageInfo; } /** * Image information */ export interface ImageInfo { width: number; height: number; xres: number; yres: number; colorspace: Colorspace; isMask: boolean; hasAlpha: boolean; bpp: number; orientation: ImageOrientation; size: number; stride: number; components: number; } /** * Image format types */ export declare enum ImageFormat { Unknown = 0, JPEG = 1, PNG = 2, GIF = 3, BMP = 4, TIFF = 5, WEBP = 6, PNM = 7, PAM = 8, JXR = 9, JP2 = 10 } /** * Image decoder */ export declare class ImageDecoder { /** * Detect image format from data */ static detectFormat(data: Uint8Array): ImageFormat; /** * Decode image from data */ static decode(data: Uint8Array): Image | null; /** * Get format name */ static getFormatName(format: ImageFormat): string; } //# sourceMappingURL=image.d.ts.map