Density question

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
mde

Density question

Post by mde »

Newbie question...

I'm convert-ing a PNG at 1280x720px into PDF. By default, the generated PDF comes out at ~50% larger than the original PNG.

Code: Select all

$ convert foo.png foo.pdf && acroread foo.pdf  # oops, too big by 50%
$ convert -density 110 foo.png foo.pdf && acroread foo.pdf  # via eyeball check looks pretty close to orig PNG size
Now I'm starting to make wild guesses about DPI (72?) and adding 50% to make it 108, which is pretty close to my guess-and-check density magic number. I'd like to understand (at least a little): (1) why I need to specify "-density 110", and (2) if that's really the right number. Thanks!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Density question

Post by snibgo »

I suspect you are comparing apples with oranges, "judging by eye".

What is the density of your png file?

Code: Select all

identify -verbose foo.png
You might get something like:
Geometry: 1280x720+0+0
Resolution: 72x72
Print size: 17.77x10.00
Units: PixelsPerInch
Then I would expect

Code: Select all

convert foo.png foo.pdf
to create a document 17.77 inches by 10 inches.
snibgo's IM pages: im.snibgo.com
mde

Re: Density question

Post by mde »

Thanks!
$ identify foo.png
foo.png PNG 1280x720 1280x720+0+0 8-bit DirectClass 403KiB 0.060u 0:00.070
$ convert foo.png foo-big.pdf && identify foo-big.pdf
foo-big.pdf PDF 1280x720 1280x720+0+0 16-bit Bilevel DirectClass 113KiB 0.010u 0:00.010
$ convert -density 100 foo.png foo-small.pdf && identify foo-small.pdf
foo-small.pdf PDF 922x518 922x518+0+0 16-bit Bilevel DirectClass 58.7KiB 0.010u 0:00.000
So acroreader seems to just be throwing me off. I've made sure to set its zoom level to 100% and indeed the "big" PDF looks 50% oversized (as compared to my PNG viewer at 100%, eog). But I'll presume that "identify" is telling the truth here -- that it's really maintaining the 1280x720. The big and small PDFs are the same file size. So I don't understand why the viewers don't agree, but maybe I don't need to worry about it.

FYI, this PDF is to be uploaded to SlideShare.com and I'm wanting the resolution to be at a standard size. I'm going to trust "identify" for now, and go with the default density.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Density question

Post by snibgo »

Image viewers may not use the same assumed DPI for your screen.

You might use the "-verbose" option of identify to get the density, and hence the physical dimensions.

Then "acroread foo.pdf", File, Properties, Description will tell you if the physical dimensions are the same.
snibgo's IM pages: im.snibgo.com
Post Reply