Skip to content

Commit

Permalink
chore: update readme (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
nieyuyao authored Apr 15, 2024
1 parent 518ef40 commit 3f2f3f9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: 20
node-version: 16

- name: install dependencies
run: npm install
Expand Down
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ webp.wasm is a pure Webassembly / Javascript port of libwebp. The library suppor

![CI](https://github.com/nieyuyao/webp-wasm/workflows/CI/badge.svg)
![latest tag](https://badgen.net/github/release/nieyuyao/webp-wasm)
![npm](https://img.shields.io/npm/v/wasm-webp.svg)

## Usage

```shell
npm i wasm-webp
```

## APIs

Expand Down Expand Up @@ -79,15 +86,15 @@ A more advanced API is based on the WebPConfig. <b>Only the lossless and quality

`function encodeRGBA(data: Uint8Array, width: number, height: number, hasAlpha: boolean,config: Partial<WebPConfig>): Promise<Nullable<Uint8Array>>`

- hasAlpha: boolean
- hasAlpha: `boolean`

Whether to include alpha chanel.

- WebPConfig.lossless: number
- WebPConfig.lossless: `number`

Lossless encoding (0=lossy(default), 1=lossless).

- WebPConfig.quality: number
- WebPConfig.quality: `number`

Between 0 and 100. Default value is 100.

Expand All @@ -108,17 +115,17 @@ Returns animated WebP like `GIF`.

`function encodeAnimation(width: number, height: number, hasAlpha: boolean, frames: WebPAnimationFrame[]): Promise<Nullable<Uint8Array>>`

- hasAlpha: boolean
- hasAlpha: `boolean`

Whether to include alpha chanel.

The WebPAnimationFrame has follow properties:

- WebPAnimationFrame.data: Uint8Array
- WebPAnimationFrame.data: `Uint8Array`

Frame bitmap.

- WebPAnimationFrame.duration: number
- WebPAnimationFrame.duration: `number`

Duration of frame.

Expand Down

0 comments on commit 3f2f3f9

Please sign in to comment.