function createJpg(pngImage, outImage) {
//原始图片是1080*1565,thumb缩小2.5倍,即1565/2.5 = 626
let cmd = 'sips -s format jpeg -Z 626 "' + pngImage + '" --out \'' + outImage + '\'';
if (shell.exec(cmd).code !== 0) {
console.log('Error: Covert failed ');
shell.exit(1);
}
}
function createPng(pngImage, outImage) {
//原始图片是1080*1565,thumb缩小2.5倍,即1565/2.5 = 626
let cmd = 'sips -s format png -Z 626 "' + pngImage + '" --out \'' + outImage + '\'';
if (shell.exec(cmd).code !== 0) {
console.log('Error: Covert failed ');
shell.exit(1);
}
}mac下通过sips进行图片转
最新推荐文章于 2025-10-21 14:27:42 发布
本文介绍了一种使用sips命令行工具将PNG格式图片转换为JPEG和PNG格式的方法。通过编写简单的脚本实现了图片格式的批量转换,并调整了图片大小。
820

被折叠的 条评论
为什么被折叠?



