LoginSignup
4
3

More than 1 year has passed since last update.

画像圧縮ツールsquoosh-cliをつかってみた

Last updated at Posted at 2023-02-17

画像を一括で圧縮とか、webpに変換してくれるsquoosh-cliが便利だったのでメモ

環境

macOS Monterey

node バージョン

v14.20.0

  • 他のバージョンだとインストールエラーがおきたり、インストールできても変換するときにエラーがでたりした。18と16でだめだった。

squoosh-cli

@squoosh/cli - npm

インストール

npm i -g @squoosh/cli

コマンド例

# jpgを80%で圧縮
squoosh-cli --mozjpeg '{"quality":80}' -d ./compressed ./*.jpg

# pngを80%で圧縮
squoosh-cli --oxipng '{"quality":80}' -d ./compressed ./*.png

# jpgをwebpに変換
squoosh-cli --webp auto -d ./ ./*.jpg

参考サイト

SEOの画像最適化を一括で超簡単に行う方法【squoosh-cli】

4
3
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
4
3