Optimizing images with imagemin

Bahadir Balban

Started Tech Buzz


  1. Install imagemin and its related plugins globally:

    npm install -g imagemin
    npm install -g imagemin-mozjpeg
    npm install -g imagemin-pngquant
    npm install -g imagemin-webp
    npm -g install imagemin-cli
  2. Run imagemin with relevant plugin:

    imagemin ~/Dropbox/buzz-logo-round.png  --out-dir=build --plugin=pngquant

Can you tell which image below is optimized:

This original jpeg image is 207Kb in size.

The one above is 207Kb in size. It is a Jpeg. The one below is 78Kb in size, after running imagemin-mozjpeg on it. I cannot tell the difference.

This jpeg image is 78Kb in size.

Join The Discussion