# 輸出當前目錄所有jpg圖片
for f in `ls "*.jpg"`;do echo "$f"; done
# 輸出所有png圖片高度和寬度
for f in `find . -name "*.png"`; do echo "$f"; echo `sips -g pixelHeight $f | awk -F: '{printf("%d", $2)}'` `sips -g pixelWidth $f | awk -F: '{printf("%d", $2)}'`; done
格式轉(zhuǎn)換
# 只轉(zhuǎn)換當前目錄內(nèi)的圖片
for f in `ls *.jpg`;do sips -s format png "$f" --out "${f%.*}.png"; echo "${f%.*}.png"; done
# 轉(zhuǎn)換當前目錄下所有png圖片(包含子目錄圈暗,目錄結(jié)構(gòu)不變)
for f in `find . -name "*.png"`; do sips -s format jpeg "$f" --out "${f%.*}.jpg"; echo "${f%.*}.jpg"; done
批量修改尺寸 (放大2倍)
for f in `find . -name "*.png"`;
do sips -z `sips -g pixelHeight $f | awk -F: '{printf("%d", $2*2)}'` `sips -g pixelWidth $f | awk -F: '{printf("%d", $2*2)}'` "$f" --out "$f"; echo "ok";
done