How to include and use native imagemagick on server in Craft? Craft v2.6.x

I want to write a plugin to grab thumbnails of PDFs.

I have my stand alone php code with imagemagick on server working like this:

$im = new Imagick();
$pdf = 'assets/documents/resources/after-release-impact-seafarers.pdf';

$im-&gt;setResolution(300,300);
//$im-&gt;setCompressionQuality(95);
//$im-&gt;scaleImage(200,0);
$im-&gt;readimage($pdf . '[0]');
$im-&gt;setImageFormat('jpeg');
//$im-&gt;resizeImage( 640, 905, imagick::FILTER_POINT, 1 );
//$im-&gt;resizeImage( 400, 565, imagick::FILTER_POINT, 1 );
$im-&gt;resizeImage( 180, 232, imagick::FILTER_POINT, 1 );

$im-&gt;writeImage('1a2w12thumb.jpg');
$im-&gt;clear();
$im-&gt;destroy();


However, how can I load imagemagick - which works on the server in my PDF thumbnail plugin class function?
I have tried:

    $im = new \Imagick();

    $im-&gt;setResolution(300,300);
    $im-&gt;readimage($pdfAsset . '[0]');
    $im-&gt;setImageFormat('jpeg');
    $im-&gt;resizeImage( 640, 905, imagick::FILTER_POINT, 1 );
    $im-&gt;writeImage($pdfAsset-&gt;writepath.$pdfAsset-&gt;filename . '.jpg');
    $im-&gt;clear();
    $im-&gt;destroy();


But none of the functions for imagemagick work:
Eg. error i get is Class 'Craft\imagick' not found

Is this a namespace issue with the imagine library? (I sound like I know what I am talking about but I am not sure I do!)

How to include/ use native imagemagick on server in Craft?
If you want to work with PECL imagick, which is the PHP wrapper for the ImageMagick library, then this should work:

$im = new \Imagick();


It's not namespaced, so it exists in the global namespace, which is what the \ does for you.