Centering a JPG image to 8.5 x 11 PDF conversion

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
David Bethel
Posts: 6
Joined: 2014-01-18T07:00:10-07:00
Authentication code: 6789

Centering a JPG image to 8.5 x 11 PDF conversion

Post by David Bethel »

Greetings,

I'm converting multiple 2,000 x 1,600 jpg images to a multi-page PDF ( 11x8.5 paper) 72 DPI

I can get the paper size correct but haven't found he correct parameter to center the image on the page. The image is currently offset to the left side of the page.

Code: Select all

@echo on
convert m:\acad\ar-*.jpg  -resize 765x612  -extent 792x612  -background white  m:\acad\ar-.pdf 
pause
Any suggestions would be very appreciated. -David
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Centering a JPG image to 8.5 x 11 PDF conversion

Post by fmw42 »

try adding -gravity center before the -extent and put the -background white before the -extent also (though the latter will not usually make a difference, it is proper IM syntax for settings to go before the operators)

see
http://www.imagemagick.org/Usage/crop/#extent
David Bethel
Posts: 6
Joined: 2014-01-18T07:00:10-07:00
Authentication code: 6789

Re: Centering a JPG image to 8.5 x 11 PDF conversion

Post by David Bethel »

Prefect ! I had tried -gravity center but not in that order.

Code: Select all

@echo on
C:\IM\convert m:\acad\ar-*.jpg  -resize 765x612  -gravity center  -background white  -extent 792x612  m:\acad\ar-.pdf 
pause
Thanks! -David
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Centering a JPG image to 8.5 x 11 PDF conversion

Post by fmw42 »

See http://www.imagemagick.org/Usage/basics/#why regarding proper syntax order
David Bethel
Posts: 6
Joined: 2014-01-18T07:00:10-07:00
Authentication code: 6789

Re: Centering a JPG image to 8.5 x 11 PDF conversion

Post by David Bethel »

Wow ! That's a bit complex ! Thanks~! -David
Post Reply