Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/node-libraries/wasm-avif-encoder
WebAssembly avif encoder with WebWorker support
https://github.com/node-libraries/wasm-avif-encoder
Last synced: 1 day ago
JSON representation
WebAssembly avif encoder with WebWorker support
- Host: GitHub
- URL: https://github.com/node-libraries/wasm-avif-encoder
- Owner: node-libraries
- Created: 2024-02-16T00:03:49.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-08-31T00:19:24.000Z (5 months ago)
- Last Synced: 2024-12-23T19:44:00.810Z (about 1 month ago)
- Language: Makefile
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @node-libraries/wasm-avif-encoder
# Overview
Provides the ability to encode WebP using WebAssembly and WebWorker.
Remix(esbuild) and Next.js(webpack) are supported.
# types
```ts
encode(params:{data: BufferSource, width: number, height: number, quality?: number}): Promise
``````ts
encode(params:{data: ImageData, quality?: number}): Promise
```# usage
```ts
import { encode } from '@node-libraries/wasm-avif-encoder';// Next.js(webpack)
const encodedValue = await encode({ data: ctx.getImageData(0, 0, img.width, img.height) });
const encodedValue2 = await encode({ data: arrayBuffer, width, height });// Remix(esbuild)
// Files need to be installed manually
// node_modules/@node-libraries/wasm-webp-encoder/dist =>
// public/avif/worker.js
// public/avif/avif.js
// public/avif/avif.wasm
const encodedValue3 = await encode({ data: arrayBuffer, width, height, worker: '/avif/worker.js' });
```# Sample when used with Next.js
- https://github.com/SoraKumo001/next-webp