Image optimizations with Squish

For many, many moons I have continually been using ImageOptim to optimize all the images in my layout. This works well but unfortunately, the one drawback is that you cannot use it when images need to be uploaded from a backend system (i.e. Photo Gallery, Avatars, etc).

During Hack Day at work, I set out to solve this very problem. I created Squish, a wrapper around good image manipulation tools (image_optim/imgmin).

Squish is primarily for command line use only. It handles two types of optimization; lossy and lossless.

  • Lossless optimization will shrink the file size but you will not lose quality.
  • Lossy optimization will shrink the file size greatly but you may lose some quality.

Installation:

# grab the repo
$ git clone git@github.com:joshbenham/squish.git

# change into the squish directory
$ cd squish

# install python requirements
$ pip install --requirement requirements.txt

# symlink it to your bin directory
$ ln -s squish_r /usr/local/bin/squish

Usage:

# check the help
$ squish --help

# lossless optimization
$ squish --lossless image.jpg
$ squish --lossless folder/

# lossy optimization 
$ squish --lossy image.jpg
$ squish --lossy folder/

# both optimizations
$ squish --lossy --lossless image.jpg
$ squish --lossy --lossless folder/

Comments !

social