title: Php Imagick : Pdf are converted into JPG with Very bad quality
body: <p>I am using Imagick extension in my one of project. This is new for me.</p>
  
  <p>The following is my code.</p>
  
  <pre><code>                $pdfPath = $config['upload_path'] . '/' . $fileName;
                  $im = new imagick();
                  $im-&gt;setResolution(300, 300);
                  $im-&gt;readImage($pdfPath);
                  $im-&gt;setImageFormat('jpeg');
                  $im-&gt;setImageCompression(imagick::COMPRESSION_JPEG); 
                  $im-&gt;setImageCompressionQuality(100);
                  $im-&gt;writeImage($config['upload_path'] . '/' . str_replace('pdf', 'jpeg', $fileName));
                  $im-&gt;clear();
                  $im-&gt;destroy();
  </code></pre>
  
  <p>This gives me very poor quality in image. 
  All text are converted into black background. Images are also not showing proper. 
  See below image, which is converted from PDF.
  <a href="https://i.stack.imgur.com/G3LGe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/G3LGe.png" alt="enter image description here"></a>
  Please help me.</p>