Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用 gm 将文件从一种类型“转换”为另一种类型?(例如 .png > .jpg)
我找到了这个,但node.js 版本似乎没有相同的方法:
您需要更改输出文件的格式。
var writeStream = fs.createWriteStream("output.jpg"); gm("img.png").setFormat("jpg").write(writeStream, function(error){ console.log("Finished saving", error); });
http://aheckmann.github.io/gm/docs.html#setformat