Page 1 of 1

get initial resolution of PDF to generate jpg

Posted: 2008-07-09T05:03:05-07:00
by blanca
I am currently using Jmagick to convert a pdf to several jpg. Why I know the initial resolution of pages PDF? My goal is to generate jpg with the original resolution. For example, imagine that the pdf file was generated with a jpg file of 300 dpi. Then, when I do info.setDensity,

ImageInfo info = new ImageInfo(pdf.getAbsolutePath());
info.setDensity("200");

I would like put the next:

info.setDensity("dpi of pdf file")

how do it???
Thanks

Re: get initial resolution of PDF to generate jpg

Posted: 2008-07-09T19:18:44-07:00
by anthony
A PDF does not have a 'fixed' resolution. Or at least it is not supposed to. This is a property of VECTOR image type formats.
http://imagemagick.org/Usage/formats/#vector

However if a PDF has a raster image in it. That image may have an ideal resolution, for which it was generated. The image however should be automatically scaled appropriatally for the resoution the PDF is being 'printed' to or 'displayed' at.

Re: get initial resolution of PDF to generate jpg

Posted: 2008-07-10T00:00:06-07:00
by blanca
"The image however should be automatically scaled appropriatally for the resoution the PDF is being 'printed' to or 'displayed' at." But, How know the PDF resolution? It's essential to scale the images.
Thanks.

Re: get initial resolution of PDF to generate jpg

Posted: 2008-07-10T04:56:45-07:00
by blanca
Really what I mean is: how can I know the ideal resolution for which was generated the images from PDF file?
Thanks

Re: get initial resolution of PDF to generate jpg

Posted: 2008-07-10T23:28:43-07:00
by anthony
That is a million dollar question! And basically I don't think you can know!

I have a similar problem for extracting such pictures and images from PDF and postscript files, directly at the resolution it was saved in that file. That is the image that is present without any resizing or scaling. I have yet to find a solution.

The problem is both PDF and PS are languages, not just data files. They have programs that can obfuscate, modify and rescale that data during the 'printing' process. Unless you are dealing with a well known 'version' or format style of PDF or Postscript, you can not get the image data without it being 'drawn'. The language is not designed for that. Period.