0

使用 gifsicle

我正在尝试调整上传的动画 gif 文件的大小。

但似乎我不认识 gifsicle 中的路径。

Error: Command failed: C:\Users\USER\Desktop\giftest\node_modules\gifsicle\vendor\gifsicle.exe -o testtttt.gif upload/test.gif #0-30

C:\Users\USER\Desktop\giftest\node_modules\gifsicle\vendor\gifsicle.exe:upload/test.gif: No such file or directory
console.time("execute time");
execFile(
  gifsicle,
  ["-o", "output.gif", "upload/input.gif", "#0-30"],
  (err) => {
    console.timeEnd("execute time");

    if (err) {
      console.log(err);
    } else {
      console.log("image resized!");
    }
  }
);

我想加载 upload/input.gif 。但 gifsicle 似乎只识别 '/' 路径。

有什么解决办法吗?

4

0 回答 0