You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何批量将300个PNG文件转换为JPG?(可用Ubuntu服务器与macOS)

批量将PNG转换为JPG(Ubuntu & macOS)

Ubuntu 服务器操作

  • 安装ImageMagick工具(专业图片处理工具):
    sudo apt update && sudo apt install imagemagick
    
  • 进入PNG文件所在文件夹,执行批量转换命令:
    for file in *.png; do convert "$file" "${file%.png}.jpg"; done
    
    • 如需调整JPG画质(数值范围0-100,数值越高画质越好),使用以下命令:
      for file in *.png; do convert "$file" -quality 90 "${file%.png}.jpg"; done
      

macOS 操作

方法一:使用ImageMagick(跨平台通用工具)

  • 通过Homebrew安装ImageMagick(未安装Homebrew请自行完成安装):
    brew install imagemagick
    
  • 进入目标文件夹,执行和Ubuntu一致的转换命令:
    for file in *.png; do convert "$file" "${file%.png}.jpg"; done
    

方法二:使用系统自带sips命令(无需额外安装)

直接在PNG文件所在文件夹执行:

for file in *.png; do sips -s format jpeg "$file" --out "${file%.png}.jpg"; done
  • 调整画质可添加formatOptions参数:
    for file in *.png; do sips -s format jpeg -s formatOptions 90 "$file" --out "${file%.png}.jpg"; done
    

内容的提问来源于stack exchange,提问作者Maxiwee

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.03 09:41:32