octopus | the octopress commander


The crunch command performs compression of .png and .jpg files. You can perform your compression from any directory inside your Octopress site. It is not necessary for the images directory to be the working directory when you run the command.


oc crunch (--option) <filename substring>


PNG compression requires advpng. JPG compression requires jpegtran.


Argument Description
image filename substring a substring in the image filename

Mandatory Switches

Option Description
--jpg Compress .jpg file
--png Compress .png file


Option Description
-a | --all Compress all files in directory (png only)
-f | --file Specify full filepath (instead of substring search)


Compression of 'beach.jpg'

oc crunch --jpg beach

Compression of 'beach.png'

oc crunch --png beach

Compress all .png files in directory

oc crunch --png --all

Compress file by specifying full filename

oc crunch --png -f beach.png


The -f (or --file) option allows you to specify the exact filename in order to prevent multiple file matches with the substring matching pattern *your-substring*.png that is used with the default command.

Here's an example:

You have the files big-octopus.png and big-octopus-2.png. If you use the default command and attempt to match the former file, you will always match the latter file as well because the match is performed with the pattern *big-octopus*.png. The solution is to use the -f switch with big-octopus.png as the argument.