Page 1 of 1

Converting from jpg or tif to pdf: size of the pdf

Posted: 2017-02-25T23:52:14-07:00
by Jean-Pierre Coulon
How can I change the size (in cm or in) of the pdf without changing the resolution? Of course -resize change this size but it also changes the resolution.

Re: Converting from jpg or tif to pdf: size of the pdf

Posted: 2017-02-25T23:57:56-07:00
by fmw42
What do you mean by resolution? If you have a PDF, it is a vector file with no defined resolution. You have to use -density before reading the pdf to change the resolution for converting to raster or for printing. Please clarify your question.

Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at viewtopic.php?f=1&t=9620

For novices, see

viewtopic.php?f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/

Re: Converting from jpg or tif to pdf: size of the pdf

Posted: 2017-02-26T09:51:51-07:00
by snibgo
"-density" will change the physical size (in inches or centimetres) of the PDF without changing the pixels. Eg:

Code: Select all

convert rose: -density 300 out.pdf
Does that answer the question?

Re: Converting from jpg or tif to pdf: size of the pdf

Posted: 2017-02-26T12:47:37-07:00
by Jean-Pierre Coulon
snibgo wrote: 2017-02-26T09:51:51-07:00 "-density" will change the physical size (in inches or centimetres) of the PDF without changing the pixels. Eg:

Code: Select all

convert rose: -density 300 out.pdf
Does that answer the question?
Yes it does. With Acrobat Reader, Document properties, I see the document size decrease when the density increases. But I have to try a density at random and calculate the ratio present size/desired size and adapt the new density to it.

Can't I specify the new desired size directly?

Which command line can give me my IM version?

Re: Converting from jpg or tif to pdf: size of the pdf

Posted: 2017-02-26T13:06:43-07:00
by snibgo
"convert -version" will output the version information.

In v6, "-density" needs a number. You can calculate that in a shell script.

In v7, "-density" can use a calculation. For example:

Code: Select all

magick in.png -density %[fx:w/2] out.pdf
This will make the PDF 2 inches wide.

Re: Converting from jpg or tif to pdf: size of the pdf

Posted: 2017-02-27T02:41:48-07:00
by Jean-Pierre Coulon
snibgo wrote: 2017-02-26T13:06:43-07:00 In v7, "-density" can use a calculation. For example:

Code: Select all

magick in.png -density %[fx:w/2] out.pdf
This will make the PDF 2 inches wide.
Works fine, thanks.