Command line and GUI image compression tools on macOS

GUI or commandline tools that converts image formats and compresses on Mac. Use it to reduce the size of the image.

GUI tool

ImageOptim is an easy-to-use GUI tool is a GUI tool for compressing image. This tool can compress all the images contained in the folder at once. But, processing may take a while.

Commandline tools

Commandline tools are easy-to-use and speedy to compress or convert images, if you are familiar with the command line.

Compress png images

pngquant is good tool.

Install pngquant

1
$ brew install pngquant

How to use pngquant

Compress and save it as a another file leaving the original image
1
2
$ pngquant image.png
$ pngquant dir/*.png
Compress and overwrite the original image
1
2
$ pngquant --ext .png --force image.png
$ pngquant --ext .png --force dir/*.png
Other option

For other detailed options refer to the official website : pngquant.

Compress jpeg images

jpegoptim is good tool.

Install jpegoptim

1
$ brew install jpegoptim

How to use pngquant

Compress and save it as a another file leaving the original image
1
2
$ jpegoptim fff.jpeg
$ jpegoptim dir/*.jpeg
Compress and overwrite the original image
1
2
$ jpegoptim --ext .png --force image.png
$ jpegoptim --ext .png --force dir/*.png

To erase all the meta data (location,date,etc…) contained in jpeg and compress it and save it, use the -s option.

1
$ jpegoptim -s image.jpeg
Other option

For other detailed options refer to the --help option.

1
$ jpegoptim --help
Other tools to compress jpg images

There are other tools such as Guetzli and Mozjpeg, so it may be good to use it.Both tools can be installed with brew command.

1
2
$ brew install guetzli
$ brew install mozjpeg

webp に変換

For images in jpg or png format, converting the format to WebP is often the smallest size.

Install webp

1
$ brew install webp

How to use webp

1
$ cwebp image.png -o image.webp
Other option
1
$ cwebp -longhelp