Detalhes do pacote

@cwasm/webp

LinusU36.7kMIT0.1.5

WebP decoding for Node.js, using [libwebp][libwebp] compiled to [WebAssembly][WebAssembly].

readme (leia-me)

WebP

WebP decoding for Node.js, using libwebp compiled to WebAssembly.

Installation

npm install --save @cwasm/webp

Usage

const fs = require('fs')
const webp = require('@cwasm/webp')

const source = fs.readFileSync('image.webp')
const image = webp.decode(source)

console.log(image)
// { width: 128,
//   height: 128,
//   data:
//    Uint8ClampedArray [ ... ] }

API

decode(source)

  • source (Uint8Array, required) - The WEBP data
  • returns ImageData - Decoded width, height and pixel data