Skip to content

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

JavaScript

Add PNG encoding support

Surma139b635eed69
diff --git a/cli/src/codecs.js b/cli/src/codecs.js
index 1ad33bdc..854668f2 100644
--- a/cli/src/codecs.js
+++ b/cli/src/codecs.js
@@ -133,7 +133,10 @@ export default {
},
enc: async () => {
await pngEncDecPromise;
- return { encode: (...args) => new Uint8Array(pngEncode(...args)) };
+ return {
+ encode: (buffer, ...args) =>
+ new Uint8Array(pngEncode(new Uint8Array(buffer), ...args))
+ };
},
defaultEncoderOptions: {}
}
diff --git a/codecs/png/Cargo.lock b/codecs/png/Cargo.lock
index ea2dfdc0..652fb0a7 100644
--- a/codecs/png/Cargo.lock
+++ b/codecs/png/Cargo.lock
@@ -116,7 +116,6 @@ dependencies = [
name = "squoosh-png"
version = "0.1.0"
dependencies = [
- "log",
"png",
"wasm-bindgen",
"web-sys",
diff --git a/codecs/png/pkg/squoosh_png_bg.wasm b/codecs/png/pkg/squoosh_png_bg.wasm
index 3f81e9a3..9de06b41 100644
Binary files a/codecs/png/pkg/squoosh_png_bg.wasm and b/codecs/png/pkg/squoosh_png_bg.wasm differ