octopus | the octopress commander


crunch

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.

Usage

oc crunch (--option) <filename substring>

Dependencies

PNG compression requires advpng. JPG compression requires jpegtran.

Arguments

Argument Description
image filename substring a substring in the image filename

Mandatory Switches

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

Options

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

Examples

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

Notes

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.