2

I have a bunch of images and trying to convert them to pdf using the below command:

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

It makes a pdf of A4 size. But the images are not centered. They are movied to NorthWest side. How to ensure the images are centered (both side ways and up and down)

Santhosh
  • 409

1 Answers1

3

Put -gravity center before the -extend option:

convert *.jpg -resize 1240x1753 -background white \
    -gravity center -extent 1240x1753 \
    -units PixelsPerInch -density 150x150 multipage.pdf
Freddy
  • 25,565