1

I have an image foo.png which is 1240 * 1754 pixels.

Using imagemagick on OS X, I convert this to a .pdf and specify the resolution to be 150 dots per inch, so its physical format will be exactly an A4 sheet:

convert -units PixelsPerInch -density 150 foo.png bar.pdf

However, if I now check the resolution of the resulting file:

identify -verbosy bar.pdf | grep Resolution

it says:

Resolution: 72x72

Note: the image should not be scaled or resized or anything. It's 1240 * 1754 and should stay that way. I just want to make sure the PDF covers exactly one full A4 sheet, which is the case with these pixel dimensions at 150 dpi.

How do I make sure the resulting .pdf file has the right resolution?

(Edit) Come to think of it, I realize that perhaps a PDF document (even if it's just a single page) doesn't necessarily have one overall dots per inch or resolution setting.
In this case I'm creating a PDF out of one image, but in general, a PDF can contain many elements, possibly all with different resolutions.

So I'm wondering, maybe with my approach I'm only setting the dpi for just this image, but the Resolution that is reported by identify -verbose bar.pdf is something else entirely?

2
  • Open the page in Acrobat Pro, and then use the Object Inspector, which is part of the Print Production tools.
    – Max Wyss
    Jun 4, 2016 at 0:02
  • @MaxWyss Thanks, but unfortunately I don't have Acrobat.
    – RocketNuts
    Jun 4, 2016 at 10:51

3 Answers 3

2

When converting from image to pdf, lowering the density improves the resolution.

convert -units PixelsPerInch -density 72 foo.png bar.pdf

On the other hand, when converting from pdf to print quality image, the density should be high.

convert -units PixelsPerInch -density 600 bar.pdf foo.png

I could not find any documentation for this though.

(This is an old question. Hopefully, it will help those who are still looking for an answer.)

0

Try this:

convert foo.png -page A4 bar.pdf
3
  • Same result, unfortunately. It still says Reslution: 72x72. I noticed that the output of identify -verbose bar.pdf also shows: Geometry: 595x842+0+0 and Page geometry: 595x842+0+0 (both with your command as well as mine). Not sure what that means?
    – RocketNuts
    Jun 4, 2016 at 10:49
  • Does your image fit into A4 page this method or your method?
    – Serge
    Jun 4, 2016 at 12:10
  • I'm not sure, how do I check? By looking at the identify -verbose result, the Geometry doesn't like anything related to A4, and neither does the 72x72 resolution.
    – RocketNuts
    Jun 4, 2016 at 14:38
0

the native DEFAULT resolution of a PDF is 72 points per inch thus a 1" x 1" image of one dot per point will be arguably 72dpi but that's not the way it should be counted its pixels of 72 wide by 72 high at a placement scaled to 1" square.

So the original is 1240 wide 1754 high and to be applied to 210 mm x 297 mm so its roughly 6.095 dots per mm horizontal and 5.905 dots per mm vertical (not a very useful description).

The target is A4 scale at a desired density of 150 dots per inch that's in PDF terms an image 1,240.157 dots wide by 1,753.937 high at a true scale of 72 points per inch.

We can not have sub pixels so its rounded to 1240 x 1754 @ 72 x 72 ptpi Thus also not a sensible description but accurate

It will be more sensible if we add @ 150 pxpi (as a nominal pixel density) and most images in PDF will use those units in hdpi and vdpi or x-ppi y-ppi terms such as

--0000.ppm: page=1 width=1800 height=682 hdpi=599.67 vdpi=599.12 colorspace=DeviceRGB bpc=8
--0001.ppm: page=3 width=1834 height=665 hdpi=345.93 vdpi=345.75 colorspace=DeviceRGB bpc=8

or

>pdfimages -list tt.pdf
page   num  type   width height color comp bpc  enc interp  object ID x-ppi y-ppi size ratio
--------------------------------------------------------------------------------------------
   1     0 image     950   575  gray    1   8  image  no        27  0    72    72 42.4K 7.9%
   1     1 image     950   575  index   1   8  image  no        19  0    72    72 2454B 0.4%

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .