Ref: Gitlab, Blog
Keywords:
Keywords:
先装压缩库。
brew install pngquant zopfli
用 Automator 创建一个名为 CompressScreenshot 的 Folder Action,选择监听 Desktop,然后创建一个 Run Shell Script,注意 Pass Input as argument。
for f in "$@"
do
if [[ $(file --mime-type -b "$f") == image/*g ]]; then
/usr/local/bin/pngquant 64 --skip-if-larger --ext=.png --force "$f"
/usr/local/bin/zopflipng -y "$f" "$f"
fi
done