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
get initial resolution of PDF to generate jpg
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: get initial resolution of PDF to generate jpg
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.
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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: get initial resolution of PDF to generate jpg
"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.
Thanks.
Re: get initial resolution of PDF to generate jpg
Really what I mean is: how can I know the ideal resolution for which was generated the images from PDF file?
Thanks
Thanks
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: get initial resolution of PDF to generate jpg
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.
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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/