@volue/wasm-codecs-gifsicle
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@wasm-codecs/gifsicle npm version license downloads

Gifsicle WebAssembly Codec

Table of contents

  1. Installation
  2. Usage
  3. API
  4. Examples
  5. License

Installation

npm install @wasm-codecs/gifsicle

Requirements:

  • Node.js 10 or later

Usage

import encode from '@wasm-codecs/gifsicle';

(async () => {
  const encodedImage = await encode(image, encodeOptions);
})();

API

encode(image, encodeOptions?): Buffer

Returns a buffer containing the compressed image data.

image: Buffer

Buffer of a GIF image.

encodeOptions?: EncodeOptions

All encoding options are optional and fall back to the default values.

type EncodeOptions = {
  optimizationLevel?: number;
  interlaced?: boolean;
  colors?: number;
  width?: number;
  height?: number;
}

Examples

Using Node.js

import fs from 'fs';
import encode from '@wasm-codecs/gifsicle';

(async () => {
  // read input image as a buffer
  const data = fs.readFileSync('in.gif');

  // encode the image using @wasm-codecs/gifsicle
  const output = await encode(data);

  // save the image to the file system
  fs.writeFileSync('out.png', output);
})();

License

Licensed under the MIT license.

© Copyright Cyril Wanner

/@volue/wasm-codecs-gifsicle/

    Package Sidebar

    Install

    npm i @volue/wasm-codecs-gifsicle

    Weekly Downloads

    26

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    304 kB

    Total Files

    15

    Last publish

    Collaborators

    • aleksanderxxx
    • fima1