When I type convert stuff.pdf stuff.jpg I am not pleased with the resolution of the .jpg image.
convert -verbose stuff.pdf says: Geometry 1500x1982, Resolution=72x72, Print size: 20.8333x27.5278. The resolution is obviously wrong: a simple calculation gives 183.
Can Imagemagick guess the resolution of my .pdf input image correctly? I can see the pixels of this image when I zoom with Acrobat Reader and I would like each pixel of the jpg image to correspond to one pixel of the .pdf image. This doesn't seem to be true even by saying -density 183.
pdf to jpg, resolution
pdf to jpg, resolution
Last edited by coulon on 2010-07-01T23:55:27-07:00, edited 1 time in total.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: pdf to eps, resolution
Try a density setting, eg:
convert -density 500 stuff.pdf stuff.jpg
1500/72 = 20.8333
1982/72 = 27.5277
Where do you get 183 from?
PDF is a vector format (that might also contain bitmap images). A PDF file doesn't really have a resolution (but any embedded bitmaps do, and they can be different from each other).
convert -density 500 stuff.pdf stuff.jpg
1500/72 = 20.8333
1982/72 = 27.5277
Where do you get 183 from?
PDF is a vector format (that might also contain bitmap images). A PDF file doesn't really have a resolution (but any embedded bitmaps do, and they can be different from each other).
snibgo's IM pages: im.snibgo.com
Re: pdf to eps, resolution
Sure I don't lose any information like this, but the .jpf is huge! 21MB! Usually a 1500x2000 jpg image is less than 1MB.snibgo wrote:Try a density setting, eg:convert -density 500 stuff.pdf stuff.jpg
Sorry I thought the 20.8333 and 27.5277 were centimeters! Now I understand that 72*2.54=182.88.snibgo wrote:1500/72 = 20.8333 1982/72 = 27.5277 Where do you get 183 from?
So I think I must research the right -density compromise by trial and error. I'm sure the source pdf was obtained by converting a scanned image. I believe choosing a density multiple of 72 would provide better results. Is this true? Are densities other than the common 150,300,600 etc. possible?snibgo wrote:PDF is a vector format (that might also contain bitmap images). A PDF file doesn't really have a resolution (but any embedded bitmaps do, and they can be different from each other).
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: pdf to eps, resolution
Yes, my "500" was just an example, of course. You might get better quality from a multiple of 72. Any density is possible.
If the pdf has been created from a single raster (bitmap) image, ImageMagic might restore it to the original dimensions. I suppose it depends on whether the original conversion has created suitable metadata.
The roundtrip with ImageMagick is generally lossless, that is:
convert i1.png temp.pdf
convert temp.png i2.png
will give an image in i2.png that is identical to i1.png.
If the pdf has been created from a single raster (bitmap) image, ImageMagic might restore it to the original dimensions. I suppose it depends on whether the original conversion has created suitable metadata.
The roundtrip with ImageMagick is generally lossless, that is:
convert i1.png temp.pdf
convert temp.png i2.png
will give an image in i2.png that is identical to i1.png.
snibgo's IM pages: im.snibgo.com
Re: pdf to eps, resolution
As snibgo said, any density is possible. (It's true that images are often embedded with common densities like 150 or 300dpi - but you can't rely on that.)
For 'simple' PDFs, there are some ways to obtain a 'right' density value (apart from "trial and error"
) - also with the help of some (free) tools.
Can you provide the PDF with which you have problems?
For 'simple' PDFs, there are some ways to obtain a 'right' density value (apart from "trial and error"

Can you provide the PDF with which you have problems?
Re: pdf to eps, resolution
AFAIK you can't attach a PDF into a message to this forum. It would need about 30 lines to explainDrarakel wrote:Can you provide the PDF with which you have problems?
how I obtained it. What do you suggest to "provide" this .pdf?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: pdf to eps, resolution
You have to post your file somewhere else and then you can post a link here to where it resides.AFAIK you can't attach a PDF into a message to this forum. It would need about 30 lines to explain
how I obtained it. What do you suggest to "provide" this .pdf?
I have used
convert -density 288 image.pdf -resize 25% image.png
288 = 4 * 72dpi and so you need to resize by 1/4 = 25% to get back to the same size. This is called supersampling. You can use other densities, but just resize by the inverse multiplier. However, the larger you make the density, the longer it will take to process.
If output to jpg, then you need to add -quality and set that appropriately before the output image
Re: pdf to eps, resolution
It's always easier to give specific hints when one has an example file - that's why I was asking for your PDF.
There's no tool that gives you an ideal density value for all files with one click (at least not that I know of). Of course, it's also debatable what an 'ideal density value' means in PDFs.
But with simple PDFs, you could try an alternative PDF viewer that allows you to see the size of the embedded images (for example with Perfect PDF Reader - if you're on Windows). That should be an improvement compared to estimating the pixels size in Adobe Reader.
There's no tool that gives you an ideal density value for all files with one click (at least not that I know of). Of course, it's also debatable what an 'ideal density value' means in PDFs.
But with simple PDFs, you could try an alternative PDF viewer that allows you to see the size of the embedded images (for example with Perfect PDF Reader - if you're on Windows). That should be an improvement compared to estimating the pixels size in Adobe Reader.

Re: pdf to eps, resolution
Thanks, this gives a pretty good result.fmw42 wrote:I have used convert -density 288 image.pdf -resize 25% image.png
288 = 4 * 72dpi and so you need to resize by 1/4 = 25% to get back to the same size. This is called supersampling.
You can use other densities, but just resize by the inverse multiplier. However, the larger you make the density, the longer it will take to process.