@blazediff/codec-pngjs
v4.0.0
Published
PNG image codec using pngjs for the blazediff library
Downloads
553
Readme
@blazediff/codec-pngjs
PNG image codec using pngjs for the BlazeDiff library.
Note: This package was previously published as
@blazediff/pngjs-transformer, which is now deprecated. Please use@blazediff/codec-pngjsinstead.
Installation
npm install @blazediff/codec-pngjsAPI
read(filePath)
Reads a PNG file to image format (Uint8Array).
Parameters:
filePath(string) - Path to the PNG file
Returns: Promise<{ data: Buffer | Uint8Array | Uint8ClampedArray; width: number; height: number; }>
write(image, filePath)
Write a BlazeDiff image to a PNG file.
Parameters:
image({ data: Buffer | Uint8Array | Uint8ClampedArray; width: number; height: number; }) - Image data to writefilePath(string) - Output file path
Returns: Promise
Usage
import { codecPngjs } from '@blazediff/codec-pngjs';
const image = await codecPngjs.read('./image.png');
await codecPngjs.write(image, './output.png');