Convert a PDF to a stacked jpg

11 Nov 2021 in TIL

I built some UI mockups in Google Slides today and wanted to share the output as a single jpg file. The way to achieve this is to export the deck as PDF, use imagemagick to convert the PDF to images, then combine the images.

Once you have your PDF, save it as input.pdf in a new folder, then run the following commands:

convert -density 150 input.pdf -quality 90 output.jpg
convert -append output-* final.jpg

You'll now have a file named final.jpg in your folder that contains all of the pages from the PDF, stacked vertically.

If you'd prefer to stack the images horizontally rather than vertically, you can use +append rather than -append.