Page 1 of 1

Help with converting images to PDF

Posted: 2016-01-21T09:32:55-07:00
by Speedtorch
Hello all,

I'm completely new to ImageMagick, have no clue what I'm doing, and desperately in need of some help... I've searched the web, looked through examples, but can't find exactly what I need and I don't really understand most of the commands. :(

I need to convert images (mostly tif and jpg) into a PDF. The problem comes in that I need everything to be printable, fit on Letter size paper. Large images should be shrunk to fit (maintaining scale), small images should be enlarged to fit (maintaining scale), and images should appear at the top of the page.

This is the code I'm using. I used 1700x2200 as calc'd by 200 pixels per inch for letter size paper, but the only thing that seems to be working is shrinking large images to fit.

Code: Select all

convert -page letter -resize 1700x2200\> -resize 1700x2200\< image.tif image.pdf
The Version I'm using is: ImageMagick 6.7.2-7

Re: Help with converting images to PDF

Posted: 2016-01-21T10:10:30-07:00
by fmw42
Imagemagick syntax generally has any raster input image right after convert and before any operators that act on it. See http://www.imagemagick.org/Usage/basics/#cmdline


try

Code: Select all

convert image.tiff -resize 1700x2200! -units pixelsperinch -density 200x200 image.pdf
That may give some distortion if the aspect of the input is not the same as the aspect of 1700x2200. If that is the case, you need to decide if you want to crop or pad. Assuming the former, then

Code: Select all

convert image.tiff -resize 1700x2200 -gravity center -extent 1700x2200 -units pixelsperinch -density 200x200 image.pdf
Assuming the latter

Code: Select all

convert image.tiff -resize 1700x2200^ -gravity center -extent 1700x2200 -units pixelsperinch -density 200x200 image.pdf
see
http://www.imagemagick.org/script/comma ... p#geometry

Re: Help with converting images to PDF

Posted: 2016-01-21T12:15:51-07:00
by Speedtorch
Thank you SOOO much! I used your 2nd command (no symbols for the resize). The only thing I changed was "-gravity north" to put the images at the top (which is the first time that command ever actually worked for me). This produced the exact results I was looking for with my test images and so far the QA team is happy with the results. I really appreciate the help!