Rework the images library.

Now using M4 to preproces the files. Also updates for
Ubuntu 12.10 and Fedora 18.