Archive for February, 2009

a FAST alternative to imagemagick

Friday, February 13th, 2009

in case you have an application which uses image magick and just doesn’t perform very well you might want to take a look at ExactImage.

i have tried version 0.6.9 on ubuntu 8.10 and it is astonishingly faster!
i compared it by doing two different operations so far: cropping a 100×100 pixel portion out of a scanned a4 page (300dpi, 1bit bitmap) as well as converting the same document from pnm to png. here are the results:


psuter:/tmp/exact-image-0.6.9/objdir/frontends# time ./econvert -i barcodetest.pnm --crop "10,10,100,100" -o cropped.pnm

real	0m0.020s
user	0m0.012s
sys	0m0.012s
psuter:/tmp/exact-image-0.6.9/objdir/frontends# time convert -crop 100x100+10+10 +repage barcodetest.pnm cropped.pnm 

real	0m0.203s
user	0m0.176s
sys	0m0.032s
psuter:/tmp/exact-image-0.6.9/objdir/frontends# time convert barcodetest.pnm barcodetest.png

real	0m1.550s
user	0m1.460s
sys	0m0.060s
psuter:/tmp/exact-image-0.6.9/objdir/frontends# time econvert barcodetest.pnm barcodetest.png
bash: econvert: command not found

real	0m0.156s
user	0m0.100s
sys	0m0.060s

bottom line: ExactImage is about 10 times as fast as ImageMagick
of course ImageMagick does alot more, is more mature and so on and so forth, but maybe you are just as lucky as i and don’t need more than what ExactImage does. :)

compiling it on ubuntu
unfortunately it isn’t in any repository for ubuntu yet, and there is no .deb file for it yet.. so you have to do the work yourself:
first download it from ExactCode’s download Page or check out the newest sources from their repository. then unpack it and cd to the directory.
in order for it to compile you need to have the basic compiling stuff plus zlib. you can get it like this:

apt-get install build-essential zlib1g-dev pkg-config

you might also need some libraries in order to read all file formats. check the first lines of the configure script to get an idea what’s needed.. if you leave it away it will still compile but not supuport those filetypes..

apt-get install libpng-dev libjpeg-dev libungif4-dev libtiff4-dev 

now compile it

./configure
make

now you have the result in a subdirectory called objdir and in there you have a directory called frontends which contain the command line tools.

econvert --help

gives you an idea of what it can do .. fast .. :)