macOS 截圖自定義指南:修改命名格式、路徑與文件類型
macOS 默認的截圖命名格式為「截圖 2024-02-19 下午12.30.00.png」,且默認保存在桌面。對於需要頻繁截圖的用戶,這種冗長的命名和格式可能不便於管理。
本文介紹如何通過終端機 (Terminal) 自定義截圖的命名前綴、時間戳、保存路徑以及文件格式。
1. 修改默認命名前綴
默認前綴為「截圖」或「Screen Shot」。
修改前綴
defaults write com.apple.screencapture name "IMG"
將 "IMG" 替換為您想要的任何前綴,例如 "Capture" 或留空 ""。
去除時間戳
如果希望文件名僅為前綴+序列號,可以隱藏時間戳:
defaults write com.apple.screencapture include-date -bool false
2. 修改默認保存路徑
默認保存在桌面 (Desktop),容易導致桌面雜亂。建議創建專門的截圖文件夾。
設置新路徑
假設您在圖片文件夾下創建了 Screenshots 目錄:
mkdir -p ~/Pictures/Screenshots
defaults write com.apple.screencapture location ~/Pictures/Screenshots
3. 修改默認文件格式
默認格式為 PNG (質量高但體積大)。可根據需求改為 JPG (體積小) 或 PDF。
修改為 JPG
defaults write com.apple.screencapture type jpg
支持的格式包括:png, jpg, tiff, pdf, gif
4. 應用更改
執行上述任何命令後,必須重啟 UI 服務才能生效:
killall SystemUIServer
5. 恢復默認設置
如果需要恢復到系統默認狀態,請執行以下命令:
# 恢復默認路徑
defaults delete com.apple.screencapture location
# 恢復默認命名
defaults delete com.apple.screencapture name
# 恢復顯示時間戳
defaults delete com.apple.screencapture include-date
# 恢復默認格式 (PNG)
defaults delete com.apple.screencapture type
# 重啟服務
killall SystemUIServer