Add support for Imagick if present

Imagick is faster and more memory efficient than GD but less commonly installed. This uses Imagick if present otherwise falls back on GD. This may help reduce out of memory errors on larger images.