UNPKG

image-in-browser

Version:

Package for encoding / decoding images, transforming images, applying filters, drawing primitives on images on the client side (no need for server Node.js)

62 lines (61 loc) 2.26 kB
/** @format */ import { MemoryImage } from '../image/image.js'; import { Decoder, DecoderDecodeOptions } from './decoder.js'; import { ImageFormat } from './image-format.js'; import { PsdImage } from './psd/psd-image.js'; /** * Decode a Photoshop PSD image. */ export declare class PsdDecoder implements Decoder { /** * Information about the PSD image. */ private _info; /** * Get the PSD image information. * @returns {PsdImage | undefined} The PSD image information. */ get info(): PsdImage | undefined; /** * Get the image format. * @returns {ImageFormat} The image format. */ get format(): ImageFormat; /** * Get the number of frames available to be decoded. * @returns {number} The number of frames. */ get numFrames(): number; /** * Decode a raw PSD image without rendering it to a flat image. * @param {Uint8Array} bytes - The raw PSD image data. * @returns {PsdImage | undefined} The decoded PSD image. */ decodePsd(bytes: Uint8Array): PsdImage | undefined; /** * Test if the given file is able to be decoded by this Decoder. * @param {Uint8Array} bytes - The raw file data. * @returns {boolean} True if the file is valid, false otherwise. */ isValidFile(bytes: Uint8Array): boolean; /** * Start decoding the data as an animation sequence. * @param {Uint8Array} bytes - The raw file data. * @returns {PsdImage | undefined} The PSD image information. */ startDecode(bytes: Uint8Array): PsdImage | undefined; /** * Decode the file and extract a single image from it. * @param {DecoderDecodeOptions} opt - The decode options. * @param {Uint8Array} opt.bytes - The raw file data. * @param {number} [opt.frameIndex] - The index of the frame to decode. * @returns {MemoryImage | undefined} The decoded image. */ decode(opt: DecoderDecodeOptions): MemoryImage | undefined; /** * Decode a single frame from the data set with startDecode. * @param {number} _frameIndex - The index of the frame to decode. * @returns {MemoryImage | undefined} The decoded frame. */ decodeFrame(_frameIndex: number): MemoryImage | undefined; }