note
almut
<p> For PDF to JPG (or any other raster image format like PNG or TIFF),
you could use GhostScript to do the conversion: </p>
<c>
$ gs -q -dBATCH -dNOPAUSE -sDEVICE=jpeg -dJPEGQ88 -r150 -sOutputFile=img%d.jpg input.pdf
</c>
<p> This would create as many images (<c>img1.jpg</c> to <c>imgN.jpg</c>)
as there are pages in the PDF file.&nbsp; <c>-r</c> is the resolution
in dpi (150dpi would create an image size of 1240x1754 for A4 paper size), and
<c>-dJPEGQ</c> is the quality factor (up to 100). </p>
<p> Unfortunately, this doesn't do any anti-aliasing, so the fonts typically
look rather ragged...&nbsp; You can work around that problem by doing
the anti-aliasing yourself; which means, you'd have to oversample while
rendering from PDF to raster (e.g. by a factor of 4, i.e. 600dpi) and
then downsample with an appropriate filter. </p>
<p> ImageMagick's <c>convert</c> can be used for the latter. The
complete sequence of steps would be: </p>
<c>
$ gs -q -dBATCH -dNOPAUSE -sDEVICE=jpeg -dJPEGQ88 -r600 -sOutputFile=img%d.jpg input.pdf
$ for img in img*.jpg ; do convert $img -filter Lanczos -resize 25% -quality 90 out_$img ; done
</c>
<p> The resulting anti-aliased images <c>out_img*.jpg</c> would then have 150dpi resolution. </p>
<p> In case you have the non-<c>/usr/bin</c>-namespace-polluting sister <i>Graphics</i>Magick installed (instead of ImageMagick), the command would be <c>gm convert ...</c> </p>
<p> (Those who hold a degree in Signal Processing - or have come in
contact with filter design in some other context - might want to take
a look at the [http://www.imagemagick.org/script/command-line-options.php#filter|list]
of filters to choose from &#8212; in case of doubt, stick
with Lanczos or Kaiser for somewhat sharper, or Gaussian or Cubic
for somewhat softer results.) </p>
<p> Also, there's documentation - well hidden from daylight -
under <c>/usr/share/doc/ghostscript/Devices.htm</c>, which
explains what options are available with the individual Ghostscript output
devices (you usually need to have another package installed (e.g. <c>ghostscript-doc</c> on
Debian/Ubuntu) to have that file). </p>
794904
794904