title: Converting PDF to PNG with ImageMagick & Wand via Python
body: <p>I am using ImageMagick to convert a PDF into an image.. it works great when I try:
  <code>convert -density 150 -trim summary-reports/20211027 -quality 100 -flatten -sharpen 0x1.0  output/20211027.png</code></p>
  <p>So as far as I can tell, GS is working.</p>
  <p>I am trying to do this with a script:</p>
  <pre><code>import os
  from os.path import exists
  from wand.image import Image
  from wand.color import Color
  
  filein = &quot;summary-reports/20211027&quot;
  fileout = &quot;output/20211027.png&quot;
  
  with Image(filename=f&quot;{filein}&quot;, resolution=150) as img:
              format = &quot;PNG&quot;
              img.compression_quality = 150
              img.save(filename=fileout)
  
  </code></pre>
  <p>but it's resulting in an error:</p>
  <pre><code>wand.exceptions.WandRuntimeError: MagickReadImage returns false, but did not raise ImageMagick  exception. This can occur when a delegate is missing, or returns EXIT_SUCCESS without generating a raster.
  
  </code></pre>
  <p>What is going on here?</p>