added ability to detect and set up imagemagick dynamically