小编S m*_*hat的帖子

如何在 Node.js 中将 JPG 图像转换为 WEBP 格式?

我正在尝试使用 react.Js 上传图像并使用 multer 中间件将该图像保存在 node.Js 中。这工作完美,但现在我想使用 webp-converter 将该图像转换为 WEBP 格式,反之亦然。

但我收到此错误:

 Error: Command failed: E:\Zegal\node_modules\webp-converte
 ib/libwebp_win64/bin/cwebp.exe -q 80 2a3279b820cc23939eea0295228423ee-- 
 inspironal-quote-about-life-inspiring-words.jpg -o output.webp
 SHCreateStreamOnFileA(filename, STGM_READ, stream) failed 80070002
 Error opening input file 2a3279b820cc23939eea0295228423ee--inspirational-quo
 about-life-inspiring-words.jpg (80070002)
 OpenInputStream(filename, &stream) failed 80070002
 cannot open input file '2a3279b820cc23939eea0295228423ee--inspirational-quot
 bout-life-inspiring-words.jpg'
 Error! Could not process file 2a3279b820cc23939eea0295228423ee--inspirationa
 uote-about-life-inspiring-words.jpg
 Error! Cannot read input picture file '2a3279b820cc23939eea0295228423ee--ins
 ational-quote-about-life-inspiring-words.jpg'
Run Code Online (Sandbox Code Playgroud)

如何使用 multer 和 WEBP 在节点中解决此问题?还有其他转换解决方案吗?

const multer = require('multer');
const webp = require('webp-converter');
const path = require('path');
const storage = …
Run Code Online (Sandbox Code Playgroud)

node.js express webp multer

4
推荐指数
2
解决办法
7760
查看次数

标签 统计

express ×1

multer ×1

node.js ×1

webp ×1