简体   繁体   中英

How to convert filetype using GraphicsMagick for node.js

How do you "Convert" a file from one type to another using gm? (eg .png > .jpg)

I found this but it doesn't seem that the node.js version has the same method:

You'll need to change the format of the output file.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM