Skip to content

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

JavaScript

Free pixels

Surma94a2a7b32faa
diff --git a/codecs/avif/enc/avif_enc.cpp b/codecs/avif/enc/avif_enc.cpp
index ec2dc90d..ac949b96 100644
--- a/codecs/avif/enc/avif_enc.cpp
+++ b/codecs/avif/enc/avif_enc.cpp
@@ -65,6 +65,7 @@ val encode(std::string buffer, int width, int height, AvifOptions options) {
}
auto js_result = Uint8Array.new_(typed_memory_view(output.size, output.data));
+ avifRGBImageFreePixels(&srcRGB);
avifImageDestroy(image);
avifEncoderDestroy(encoder);
return js_result;
diff --git a/codecs/avif/enc/avif_enc.wasm b/codecs/avif/enc/avif_enc.wasm
index e1439c31..0ea1d4b3 100644
Binary files a/codecs/avif/enc/avif_enc.wasm and b/codecs/avif/enc/avif_enc.wasm differ
diff --git a/codecs/avif/package.json b/codecs/avif/package.json
new file mode 100644
index 00000000..19b0fc64
--- /dev/null
+++ b/codecs/avif/package.json
@@ -0,0 +1,6 @@
+{
+ "name": "avif",
+ "scripts": {
+ "build": "../build-cpp.sh"
+ }
+}