Added support for imagemagick, cleanup