Make images smaller using best-in-class codecs, right in the browser.
JavaScript
Using use_argb conditionally
Jake Archibaldd30a85fd4831
diff --git a/codecs/webp_enc/webp_enc.cpp b/codecs/webp_enc/webp_enc.cppindex 379912ac..3f22badc 100644--- a/codecs/webp_enc/webp_enc.cpp+++ b/codecs/webp_enc/webp_enc.cpp@@ -26,7 +26,8 @@ val encode(std::string img, int width, int height, WebPConfig config) {throw std::runtime_error("Unexpected error");}- pic.use_argb = 1;+ // Only use use_argb if we really need it, as it's slower.+ pic.use_argb = config.lossless || config.use_sharp_yuv || config.preprocessing > 0;pic.width = width;pic.height = height;pic.writer = WebPMemoryWrite;diff --git a/codecs/webp_enc/webp_enc.wasm b/codecs/webp_enc/webp_enc.wasmindex 2dc63207..99f10d5b 100644Binary files a/codecs/webp_enc/webp_enc.wasm and b/codecs/webp_enc/webp_enc.wasm differ