Skip to content

armgit / VERT

Public Imported from GitHub
0

The next-generation file converter. Open source, fully local* and free forever.

fix: fix animated WEBP to/from GIF

JovannMC8bcd7d4e5c23
diff --git a/src/lib/workers/vips.ts b/src/lib/workers/vips.ts
index 35f09f1..cde18c6 100644
--- a/src/lib/workers/vips.ts
+++ b/src/lib/workers/vips.ts
@@ -1,8 +1,7 @@
import { type WorkerMessage, type OmitBetterStrict } from "$lib/types";
import Vips from "wasm-vips";
-const vipsPromise = Vips({
-});
+const vipsPromise = Vips({});
vipsPromise
.then(() => {
@@ -21,6 +20,7 @@ const handleMessage = async (
if (!message.to.startsWith(".")) message.to = `.${message.to}`;
const image = vips.Image.newFromBuffer(
await message.input.file.arrayBuffer(),
+ `${message.to === ".gif" || message.to === ".webp" ? "[n=-1]" : ""}`,
);
const output = image.writeToBuffer(message.to);
image.delete();