mirror of https://github.com/VERT-sh/VERT.git
fix: fix animated WEBP to/from GIF
This commit is contained in:
parent
a47b5ffba9
commit
8bcd7d4e5c
|
@ -1,8 +1,7 @@
|
||||||
import { type WorkerMessage, type OmitBetterStrict } from "$lib/types";
|
import { type WorkerMessage, type OmitBetterStrict } from "$lib/types";
|
||||||
import Vips from "wasm-vips";
|
import Vips from "wasm-vips";
|
||||||
|
|
||||||
const vipsPromise = Vips({
|
const vipsPromise = Vips({});
|
||||||
});
|
|
||||||
|
|
||||||
vipsPromise
|
vipsPromise
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -21,6 +20,7 @@ const handleMessage = async (
|
||||||
if (!message.to.startsWith(".")) message.to = `.${message.to}`;
|
if (!message.to.startsWith(".")) message.to = `.${message.to}`;
|
||||||
const image = vips.Image.newFromBuffer(
|
const image = vips.Image.newFromBuffer(
|
||||||
await message.input.file.arrayBuffer(),
|
await message.input.file.arrayBuffer(),
|
||||||
|
`${message.to === ".gif" || message.to === ".webp" ? "[n=-1]" : ""}`,
|
||||||
);
|
);
|
||||||
const output = image.writeToBuffer(message.to);
|
const output = image.writeToBuffer(message.to);
|
||||||
image.delete();
|
image.delete();
|
||||||
|
|
Loading…
Reference in New Issue