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

Mac系统下如何转换HEIC图片为JPG并保留原时间戳?

批量将HEIC转换为JPG并保留原文件时间戳

Mac 平台方案

系统自带工具(无需额外安装)

使用 sips(Mac原生图片处理命令)结合 touch 同步时间戳,打开终端进入目标文件夹后执行:

for file in *.heic; do
  # 转换HEIC为JPG
  sips -s format jpeg "$file" --out "${file%.heic}.jpg"
  # 将原文件的创建/修改时间同步到新JPG
  touch -r "$file" "${file%.heic}.jpg"
done

touch -r 参数会完全复制原文件的时间属性,包括创建时间和修改时间。

功能扩展方案(ImageMagick)

如果需要调整画质等进阶参数,先通过Homebrew安装ImageMagick:brew install imagemagick,再执行:

for file in *.heic; do
  magick convert "$file" -quality 90 "${file%.heic}.jpg"
  touch -r "$file" "${file%.heic}.jpg"
done

Windows 平台方案

PowerShell原生脚本(需HEIC解码支持)

Windows 10/11需先在微软商店安装「HEIC图像扩展」(免费),打开PowerShell进入目标文件夹后执行:

Get-ChildItem -Filter *.heic | ForEach-Object {
  $jpgPath = [System.IO.Path]::ChangeExtension($_.FullName, ".jpg")
  # 转换格式
  Add-Type -AssemblyName System.Drawing
  $image = [System.Drawing.Image]::FromFile($_.FullName)
  $image.Save($jpgPath, [System.Drawing.Imaging.ImageFormat]::Jpeg)
  $image.Dispose()
  # 同步时间戳
  (Get-Item $jpgPath).CreationTime = $_.CreationTime
  (Get-Item $jpgPath).LastWriteTime = $_.LastWriteTime
}

第三方工具+Robocopy同步时间

如果不想安装系统扩展,可使用第三方HEIC转换工具(如绿色版heic2jpg),转换后用Windows自带的Robocopy同步时间:

:: 批量转换HEIC为JPG
for %f in (*.heic) do heic2jpg.exe "%f" "%~nf.jpg"
:: 同步原文件时间戳到JPG
robocopy . . *.jpg /COPY:T /MOV

/COPY:T 参数仅复制文件时间属性,/MOV 用于在当前目录内完成时间同步。

Linux 平台方案

先安装HEIC解码依赖:

# Debian/Ubuntu 系列
sudo apt install libheif-examples imagemagick
# RHEL/CentOS 系列
sudo dnf install libheif-tools ImageMagick

然后执行批量转换+时间同步:

for file in *.heic; do
  # 使用libheif自带工具转换
  heif-convert "$file" "${file%.heic}.jpg"
  # 同步时间戳
  touch -r "$file" "${file%.heic}.jpg"
done

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.09 00:40:28