How do I execute ImageMagick's convert
if I want a JPEG from the first page only of a multi-page PDF?
So if you have a vector PDF and you convert it to PDF using ImageMagick, it will rasterize the PDF to pixels (not vectors) and imbed the raster image in a vector PDF shell. That will make the output much larger than the input.
ImageMagick uses GhsotScript for that. So you can't do it with ImageMagick without GhostScript. You can use GhostScript to render PDF to JPG from command line running gswin32.exe (even without ImageMagic) or from your software using gsdll32.
ImageMagick includes a number of command-line utilities for manipulating images. Most of you are probably accustomed to editing images one at a time with a graphical user interface (GUI) with such programs as Gimp or Photoshop.
ImageMagick can resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.
If you are using a convert
command line you can execute it with these parameters:
convert source.pdf[0] output.jpeg
Note that the page count of ImageMagick is 0-based. So [0]
means 'page 1'. To select, say the 4th page, you'd have to use [3]
.
This syntax does not only work for PDF input. It also works with other multi-page or mult-frame formats, such as multi-page TIFF or animated multi-frame GIFs and PNGs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With