title: imagemagick wand save pdf pages as images
body: <p>I would like to use imagemagick Wand package to convert all pages of a pdf file into a single image file. I am having the following trouble though (see comments below which highlight problem)</p>
  
  <pre><code>import tempfile
  from wand.image import Image
  
  
  with file('my_pdf_with_5_pages.png') as f:
      image = Image(file=f, format='png')
      save_using_filename(image)
      save_using_file(image)
  
  def save_using_filename(image):
      with tempfile.NamedTemporaryFile() as temp:
          # this saves all pages, but a file for each page (so 3 files)
          image.save(filename=temp.name)
  
  def save_using_file(image):
      with tempfile.NamedTemporaryFile() as temp:
          # this only saves the first page as an image
          image.save(file=temp)
  </code></pre>
  
  <p>My end goal it to be able to specify which pages are to be converted to one continual image. This is possible from the command line with a bit of</p>
  
  <pre><code>convert -append input.pdf[0-4]
  </code></pre>
  
  <p>but I am trying to work with python.</p>
  
  <p>I see we can get slices by doing this:</p>
  
  <pre><code>[x for x in w.sequence[0:1]] # get page 1 and 2
  </code></pre>
  
  <p>now its a question of how to join these pages together.</p>