ImageMagick: convert image to PDF with A4 page size and image fit to page

Thanks to the ImageMagick support forum I was able to find a solution:

convert image.tif -resize 575x823^> -gravity center -background white -extent 595x842 image.pdf

If you get an error try:

convert image.tif -resize 595x842^\> -gravity center -background white -extent 595x842 image.pdf

Found this somewhere on stackoverflow:

convert *.jpg -resize 1240x1753 \
                      -extent 1240x1753 -gravity center \
                      -units PixelsPerInch -density 150x150 multipage.pdf

If you want to keep the original resolution (lossless) you can try the following command:

convert png.png -background white -page a4 myoutput.pdf

Based on a comment posted before: https://stackoverflow.com/a/24573341/6747994

@m4tx This command only makes sense if the picture has a resolution above 500x800px, it does not zoom in, to avoid pixelated thumbnails.


You can convert to pdf using ImageMagick

convert png.png myout.pdf

but use pdfjam instead of ImageMagick to adjust the page size

pdfjam --paper a4paper --outfile myoutA4.pdf myout.pdf

pdfjam offers other options, which may fit your needs.