LoginSignup
0
0

More than 3 years have passed since last update.

MacのAutomatorでSquooshするクイックアクション

Last updated at Posted at 2021-05-17

目的:画像を簡単に圧縮したい

Squooshで画像を圧縮するときにPWAはあるけども、開いてファイルなげて圧縮するのがめんどくさかった

完成品

画像圧縮.workflow
export PATH=$PATH:/usr/local/bin
for f in "$@"
do
    npx @squoosh/cli --mozjpeg '{"quality":75}' -s '-compressed' -d ${f%/*} $f
done

アクション

ScreenShot_20210517@2x-compressed.jpg

参考

npxのコマンドが通らない→MacのAutomatorでnpmコマンドを使う
Squooshのusage→GoogleChromeLabs / squoosh
ファイルを同じ場所に保存→dirname、basenameは「%/」と「##/」で書くと処理速度が早くなる

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0