Skip to content

Make images smaller using best-in-class codecs, right in the browser.

JavaScript

Add documentation

Surma91945da5ae81
diff --git a/codecs/webp_dec/README.md b/codecs/webp_dec/README.md
index 793d8984..5b231002 100644
--- a/codecs/webp_dec/README.md
+++ b/codecs/webp_dec/README.md
@@ -1,4 +1,4 @@
-# WebP encoder
+# WebP decoder
- Source: <https://github.com/webmproject/libwebp>
- Version: v0.6.1
@@ -13,26 +13,30 @@ See `example.html`
Returns the version of libwebp as a number. va.b.c is encoded as 0x0a0b0c
-### `uint8_t* create_buffer(int width, int height)`
+### `uint8_t* create_buffer(int size)`
-Allocates an RGBA buffer for an image with the given dimension.
+Allocates an buffer for the file data.
### `void destroy_buffer(uint8_t* p)`
Frees a buffer created with `create_buffer`.
-### `void encode(uint8_t* image_buffer, int image_width, int image_height, float quality)`
+### `void decode(uint8_t* img_in, int size)`
-Encodes the given image with given dimension to WebP. `quality` is a number between 0 and 100. The higher the number, the better the quality of the encoded image. The result is implicitly stored and can be accessed using the `get_result_*()` functions.
+Decodes the given webp file into raw RGBA. The result is implicitly stored and can be accessed using the `get_result_*()` functions.
### `void free_result()`
-Frees the result created by `encode()`.
+Frees the result created by `decode()`.
### `int get_result_pointer()`
-Returns the pointer to the start of the buffer holding the encoded data.
+Returns the pointer to the start of the buffer holding the encoded data. Length is width x height x 4 bytes.
-### `int get_result_size()`
+### `int get_result_width()`
-Returns the length of the buffer holding the encoded data.
+Returns the width of the image.
+
+### `int get_result_height()`
+
+Returns the height of the image.