diff --git a/src/bindings/wasm/tvgWasm.cpp b/src/bindings/wasm/tvgWasm.cpp index 387b6e07..f2c01b76 100644 --- a/src/bindings/wasm/tvgWasm.cpp +++ b/src/bindings/wasm/tvgWasm.cpp @@ -220,7 +220,11 @@ public: return false; } - animation->picture()->size(width, height); + //keep the aspect ratio. + float ow, oh; + animation->picture()->size(&ow, &oh); + float scale = static_cast(width) / ow; + animation->picture()->size(ow * scale, oh * scale); auto saver = Saver::gen(); if (!saver) {