处理sips --getProperty pixelHeight filename.ext
and的输出并sips --getProperty pixelWidth filename.ext
在条件中使用它,仅在需要时执行调整大小操作。
#!/bin/bash
height=`sips --getProperty pixelHeight url.png | sed -E "s/.*pixelHeight: ([0-9]+)/\1/g" | tail -1`
width=`sips --getProperty pixelWidth url.png | sed -E "s/.*pixelWidth: ([0-9]+)/\1/g" | tail -1`
if [[ $height -gt 500 || $width -gt 500 ]]; then
growlnotify -m "large file needs reducing"
fi
Run Code Online (Sandbox Code Playgroud)
你可以自己做剩下的。
归档时间: |
|
查看次数: |
3605 次 |
最近记录: |