Compiling Pngcrush on Mac OS X Snow Leopard

Pngcrush is a command line tool that processes png files through several algorithms (read “magics”), optimizing the png without quality loss. Here is how you can install it from source on snow leopard.

  1. Download Pngcrush
  2. Extract the Source Code
  3. Compile Pngcrush
  4. Using Pngcrush

Download Pngcrush

Download Pngcrush (Direct Download Link)

I save source files into ~/src/

Extract the Source Code

Open terminal and run these commands to extract the source code.

	cd ~/src
	tar -xvzf pngcrush-1.7.2.tar.gz
	cd pngcrush-1.7.2

Compile Pngcrush

While in the pngcrush-1.7.2 folder, run these commands to compile it.

	make
	sudo mv pngcrush /usr/local/bin/

The make command compiles the code. I move the executable to /usr/local/bin/ in as suggested by Dan Benjamin. It does not matter where you move the compiled executable, but I recommend that you put it in a place within your environment’s path.

Using Pngcrush

To crush a png file, run this command on the shell.

	pngcrush -reduce -brute source.png destination.png

Tags: , ,

Leave a comment