title: How to convert PDF to low-resolution (but good quality) JPEG?
body: <p>When I use the following ghostscript command to generate jpg thumbnails from PDFs, the image quality is often very poor:</p>
  
  <pre><code>gs -q -dNOPAUSE -dBATCH -sDEVICE=jpeggray -g465x600 -dUseCropBox -dPDFFitPage -sOutputFile=pdf_to_lowres.jpg test.pdf
  </code></pre>
  
  <p>By contrast, if I use ghostscript to generate a high-resolution png, and then use mogrify to convert the high-res png to a low-res jpg, I get pretty good results.</p>
  
  <pre><code>gs -q -dNOPAUSE -dBATCH -sDEVICE=pnggray -g2550x3300 -dUseCropBox -dPDFFitPage -sOutputFile=pdf_to_highres.png test.pdf
  mogrify -thumbnail 465x600 -format jpg -write pdf_to_highres_to_lowres.jpg pdf_to_highres.png
  </code></pre>
  
  <p>Is there any way to achieve good results while bypassing the intermediate pdf -> high-res png step? I need to do this for a large number of pdfs, so I'm trying to minimize the compute time.</p>
  
  <p>Here are links to the images referenced above:</p>
  
  <ol>
  <li><a href="http://partifi.org/stackoverflow/test.pdf" rel="nofollow">test.pdf</a></li>
  <li><a href="http://partifi.org/stackoverflow/pdf_to_lowres.jpg" rel="nofollow">pdf_to_lowres.jpg</a></li>
  <li><a href="http://partifi.org/stackoverflow/pdf_to_highres.png" rel="nofollow">pdf_to_highres.png</a></li>
  <li><a href="http://partifi.org/stackoverflow/pdf_to_highres_to_lowres.jpg" rel="nofollow">pdf_to_highres_to_lowres.jpg</a></li>
  </ol>