【问题标题】:Converting a PNG buffer to a JPG in graphicsmagick in node在节点的graphicsmagick中将PNG缓冲区转换为JPG
【发布时间】:2013-05-15 03:51:23
【问题描述】:

如何在不写入文件的情况下将 png 缓冲区转换为 jpg?

【问题讨论】:

标签: node.js graphicsmagick


【解决方案1】:

您可以使用https://github.com/aheckmann/gm

var gm = require('gm')

// convert a buffer to a stream
gm(buffer, 'img.png')
.stream('jpg')
.pipe(outputStream);


// convert a buffer to a buffer
gm(buffer, 'img.png')
.toBuffer('PNG',function (err, buffer) {
   if (err) return handle(err);
   console.log('done!');
})

【讨论】:

    猜你喜欢
    • 2021-01-14
    • 1970-01-01
    • 2016-09-23
    • 1970-01-01
    • 2014-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多