【发布时间】:2019-10-24 12:02:55
【问题描述】:
我正在尝试使用 package.json 一次调整图像大小并降低其 DPI。
我使用 im.convert() 而不是 im.resize() 因为我还有其他需要指定的选项。我试图将一个包含所有选项的数组传递给 im.convert(),但我收到一条错误消息,提示“错误:命令失败:无效参数 - -units”
const inputPath = "E:\PC\lister\uploads\dbmid_AAAeU6UkAOHoUmq6t25RPjK6g1sfK6gn7fg\Clients\Matt\2019-06-10T03-32-02.385Z45.jpg";'
const outputPath= "E:\PC\lister\uploads\dbmid_AAAeU6UkAOHoUmq6t25RPjK6g1sfK6gn7fg\Clients\Matt\Web\2019-06-10T03-32-02.385Z45.jpg";
const args = [
inputPath,
"-units",
"pixelsperinch",
"-density",
"75x75",
"-resize",
"1920",
outputPath
]
im.convert(args, function(err, stdout, stderr) {
if(err) console.log(err)
});
我希望在上面outputPath 中指定的名为“web”的文件夹中使用 75dpi 调整大小的图像。但我收到一条错误消息,显示“错误:命令失败:无效参数 - -units”
【问题讨论】:
标签: javascript node.js image-processing imagemagick graphicsmagick