crop multi-page pdf and merge 2 pages into 1

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dre12b
Posts: 2
Joined: 2011-04-19T23:48:51-07:00
Authentication code: 8675308

crop multi-page pdf and merge 2 pages into 1

Post by dre12b »

My goal is to (a) crop the bottom half of each page in a multi-page pdf (b) merge two pages so that the top half of page 1 is now followed by the top half of page 2 in the new document. If necessary I can use pdftk to burst the multi-page pdf into single pages, do the cropping, and then merge them back together.

Any pointers?

I'm using imagemagick 6.6.2-6 from the command-line on a linux ubuntu machine.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: crop multi-page pdf and merge 2 pages into 1

Post by fmw42 »

convert -density XX% image.pdf[0,1] +adjoin -gravity north -crop 50%x50%+0+0 +repage -append resultimage.

However, if your resultimage is pdf, then IM is not a very good tool to use as it goes from vector to raster to vector again. See http://www.imagemagick.org/Usage/formats/#vector
dre12b
Posts: 2
Joined: 2011-04-19T23:48:51-07:00
Authentication code: 8675308

Re: crop multi-page pdf and merge 2 pages into 1

Post by dre12b »

This is excellent. Many thanks! I've got to do some tinkering to dial in the setting, but it should work well for printing.

What is the (0,1)? Does that specify the pages to work with?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: crop multi-page pdf and merge 2 pages into 1

Post by fmw42 »

dre12b wrote:This is excellent. Many thanks! I've got to do some tinkering to dial in the setting, but it should work well for printing.

What is the (0,1)? Does that specify the pages to work with?
[0,1] is the list of frames/pages (or image sequence numbers) selected to use from the PDF. In this case, only those two will be processed. Be sure you square brackets. see selecting frames at http://www.imagemagick.org/script/comma ... essing.php or image sequences at http://www.imagemagick.org/Usage/basics/#image_seq
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: crop multi-page pdf and merge 2 pages into 1

Post by anthony »

Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply