title: Converting a multi page pdf to multiple pages using a single command
body: <p>I want to convert multi page pdfs into single page images efficiently. </p>
  
  <p>I already know how to do this one page at a time with imagemagick. For example,</p>
  
  <pre><code>convert x.pdf[2] x3.jpg
  </code></pre>
  
  <p>will give me the 3rd page of the pdf as an image. So if I figure out how many pages are in the pdf using <strong>identify</strong> then I can loop through and convert all pages in the pdf to images. This method can however take a while. For example a 15 page pdf could take anywhere between 15-30 seconds.</p>
  
  <p>According to answers that I have seen elsewhere (also on the imagemagick forums) the following imagemagick command should split a pdf into multiple images.</p>
  
  <pre><code>convert x.pdf x-%0d.jpg
  </code></pre>
  
  <p>but all this ends up doing is creating the first page named <strong>x-0.jpg</strong></p>
  
  <p>As an alternative I have tried using pdftk with the burst capability. The problem I faced there is that burst does not work in all cases. It does for some pdf's and does not for some others.</p>
  
  <p>Any suggestions on how to improve things would help.</p>
  
  <p>My OS is Mac OSX Lion but I do need this working on CentOS 6 as well.</p>