@napi-rs/image
Image processing library.
Support matrix
| node10 | node12 | node14 | node16 | node17 |
---|
Windows x64 | ✓ | ✓ | ✓ | ✓ | ✓ |
Windows x32 | ✓ | ✓ | ✓ | ✓ | ✓ |
macOS x64 | ✓ | ✓ | ✓ | ✓ | ✓ |
macOS arm64 (m chips) | ✓ | ✓ | ✓ | ✓ | ✓ |
Linux x64 gnu | ✓ | ✓ | ✓ | ✓ | ✓ |
Linux x64 musl | ✓ | ✓ | ✓ | ✓ | ✓ |
Linux arm gnu | ✓ | ✓ | ✓ | ✓ | ✓ |
Linux arm64 gnu | ✓ | ✓ | ✓ | ✓ | ✓ |
Linux arm64 musl | ✓ | ✓ | ✓ | ✓ | ✓ |
Android arm64 | ✓ | ✓ | ✓ | ✓ | ✓ |
Android armv7 | ✓ | ✓ | ✓ | ✓ | ✓ |
FreeBSD x64 | ✓ | ✓ | ✓ | ✓ | ✓ |
Lossless compression
PNG
export interface PNGLosslessOptions {
fixErrors?: boolean | undefined | null
force?: boolean | undefined | null
filter?: Array<number> | undefined | null
bitDepthReduction?: boolean | undefined | null
colorTypeReduction?: boolean | undefined | null
paletteReduction?: boolean | undefined | null
grayscaleReduction?: boolean | undefined | null
idatRecoding?: boolean | undefined | null
strip?: boolean | undefined | null
useHeuristics?: boolean | undefined | null
}
export function losslessCompressPng(input: Buffer, options?: PNGLosslessOptions | undefined | null): Buffer
JPEG
export interface JpegCompressOptions {
quality?: number | undefined | null
optimizeScans?: boolean | undefined | null
}
export function compressJpeg(input: Buffer, options?: JpegCompressOptions | undefined | null): Buffer