@blazediff/codec-sharp
v4.0.0
Published
Image codec using Sharp for the blazediff library
Readme
@blazediff/codec-sharp
Image codec using Sharp for the BlazeDiff library.
Note: This package was previously published as
@blazediff/sharp-transformer, which is now deprecated. Please use@blazediff/codec-sharpinstead.
Installation
npm install @blazediff/codec-sharpAPI
read(filePath)
Read an image file to BlazeDiff image format.
Parameters:
filePath(string) - Path to the image 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 { codecSharp } from '@blazediff/codec-sharp';
const image = await codecSharp.read('./image.png');
await codecSharp.write(image, './output.png');