From 8bcd7d4e5c234843320d48d582c23f17d17b5811 Mon Sep 17 00:00:00 2001 From: JovannMC Date: Tue, 11 Feb 2025 21:50:49 +0300 Subject: [PATCH] fix: fix animated WEBP to/from GIF --- src/lib/workers/vips.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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();