Page 1 of 1

How to fit an image in a pdf page without increase weight?

Posted: 2010-10-22T03:39:36-07:00
by gvdmoort
Hello,

In Gimp, it's possible to print (and thus exporting to PDF via a virtual printer) a small image and to fit it at the maximal size allowed but without increasing the number of pixels in the image. Eg I've an image of 180x180pixels here:
http://www.k1ka.be/pub/200px-Circle_-_b ... le.svg.png

In gimp, the printing dialog gives 72 dpi and a size of 63.5mm; I've adjusted the dpi to 24 and the image becomes 190.5mm of width.

The resulting pdf is here:
http://www.k1ka.be/pub/200px-Circle_-_b ... le_svg.pdf

As you can see, the weight of the PDF file is very close to this of the the bitmap one (5689 vs. 9513 bytes).

How to do the same with Image Magick ? When I try with or without the -page option, the result is the same:

Code: Select all

gv@fantasio:~$ convert    200px-Circle_-_black_simple.svg.png test.pdf
gv@fantasio:~$ ls -l test.pdf
-rw-r--r-- 1 gv gv 6277 oct 22 12:31 test.pdf
gv@fantasio:~$ convert  -page A4  200px-Circle_-_black_simple.svg.png test.pdf
gv@fantasio:~$ ls -l test.pdf
-rw-r--r-- 1 gv gv 6277 oct 22 12:31 test.pdf
and the image is not "scaled". Printed on a sheet of paper, the image is positionned at the bottom corner, and at a size around 63mm.

Has someone a proposition ?

Thanls in advance,

G.

Re: How to fit an image in a pdf page without increase weigh

Posted: 2010-10-22T10:05:15-07:00
by fmw42
IM will pixelize before converting to PDF. see http://www.imagemagick.org/Usage/formats/#vector

Re: How to fit an image in a pdf page without increase weigh

Posted: 2010-10-22T11:14:53-07:00
by gvdmoort
fmw42 wrote:IM will pixelize before converting to PDF. see http://www.imagemagick.org/Usage/formats/#vector
I know that. A lot of people misunderstand and do conversions from vector formats to raster, and are surprised by the weight of the resulting file.

But that's not the case here, it's a conversion from raster to raster "wrapped" in a description-page format: the conversion with gimp shows it's possible to include the raster image unmodified in a pdf (or in a postscript) and display it at a larger scale.

I'm wondering if IM could do so. Otherwise, I don't see the purpose of the "-page" option.