diff --git a/readme.md b/readme.md index f3352b0..7bd9954 100644 --- a/readme.md +++ b/readme.md @@ -70,26 +70,22 @@ const { Format, encode } = require("webp"); ## API -### `Format.rgba` +### `Format.rgba = 0` -Value: 0 +Standard RGBA format. -Standard RGBA format, supports both decoding and encoding. - -### `Format.yuv` - -Value: 1 +### `Format.yuv = 1` YUV I420 format, currently supports only decoding. Smaller and faster than RGBA, but less straightforward. When decoding, if the source WebP has odd dimensions, they will be rounded up to the nearest even number. -### `decode(data: Buffer, format = Format.rgba): Promise` +### `decode(data: Buffer, format: Format = Format.rgba): Promise` -Decodes the WebP image stored in the `data` buffer as `format`, which can be either `Format.rgba` or `Format.yuv`. +Decodes the WebP image stored in the `data` `Buffer` as `format`, which can be either `Format.rgba` or `Format.yuv`. Returns a promise resolving to an object with `data`, `height`, `format` and `width` properties. -### `encode(image: Image, quality = 90): Promise` +### `encode(image: Image, quality: number = 90): Promise` Encodes a raw `image` as WebP with the given `quality`. `image` must be an object with `data`, `height`, `format` and `width` properties. `image.format` currently has to be `Format.rgba`. -Returns a promise resolving to a buffer. +Returns a promise resolving to a `Buffer`.