You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by "Kirk, Kenneth" <Kk...@ILSOS.NET> on 2015/06/26 21:43:18 UTC

image Resolution

I'm sure this question has been asked before but I wasn't on the list when it was.  I have PDFs that I need to convert to images.  Most are 8.5x11.  Some are 8.5 x 3.5.  My problem is figuring out the resolution when I save them as 200dpi tiff images.  I made some assumptions that held true until I encountered PDFs that deviated from the those assumptions.  Although I can assume all PDFs are 8.5 inch wide and therefore I can deduce the resolution based of the width of the actually page I don't want to assume anything but calculate the resolution base on what I can get from the PDF structure itself.








************************************************
Disclaimer - This email and any files transmitted with it are confidential and contain privileged or copyright information. You must not present this message to another party without gaining permission from the sender. If you are not the intended recipient you must not copy, distribute or use this email or the information contained in it for any purpose other than to notify the Office of the Illinois Secretary of State. 

If you have received this message in error, please notify the sender immediately, and delete this email from your system. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of the Office of the Illinois Secretary of State. 
************************************************











Re: image Resolution

Posted by Tilman Hausherr <TH...@t-online.de>.
Lines that vanish is a somewhat unsolved problem at "low" resolutions, 
even in the 2.0 version. There's no setting from outside, and the 
settings from "inside" (i.e. change the PDFBox source code in 
PageDrawer.java, look for setRenderingHint) can have other unpleasant 
surprises.

Tilman

Am 29.06.2015 um 16:00 schrieb Kirk, Kenneth:
> Well after checking further I found that the problem was in the scaling after the image was created.  I wanting to scale it to 200 dpi using ImageIO and that is where the size discrepancy came about.  If I leave it at 72 dpi it's okay.  One other problem I having is generating a image from a PDF page with lines that are light gray.  When rendering the page as ImageType.BINARY the lines drops them out completely when the image rendered.  I have to render it as RBG first and make an extra call to convert to black and white which slow the process way down.  It seems the threshold value need to be manipulated but I'm not sure where one changes that at.
>
> -----Original Message-----
> From: Tilman Hausherr [mailto:THausherr@t-online.de]
> Sent: Friday, June 26, 2015 3:51 PM
> To: users@pdfbox.apache.org
> Subject: Re: image Resolution
>
> Why not just use the dpi parameter when rendering?
>
> Tilman
>
> Am 26.06.2015 um 21:43 schrieb Kirk, Kenneth:
>> I'm sure this question has been asked before but I wasn't on the list when it was.  I have PDFs that I need to convert to images.  Most are 8.5x11.  Some are 8.5 x 3.5.  My problem is figuring out the resolution when I save them as 200dpi tiff images.  I made some assumptions that held true until I encountered PDFs that deviated from the those assumptions.  Although I can assume all PDFs are 8.5 inch wide and therefore I can deduce the resolution based of the width of the actually page I don't want to assume anything but calculate the resolution base on what I can get from the PDF structure itself.
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: image Resolution

Posted by John Hewson <jo...@jahewson.com>.
> On 29 Jun 2015, at 07:00, Kirk, Kenneth <Kk...@ILSOS.NET> wrote:
> 
> Well after checking further I found that the problem was in the scaling after the image was created.  I wanting to scale it to 200 dpi using ImageIO and that is where the size discrepancy came about.  If I leave it at 72 dpi it's okay.  One other problem I having is generating a image from a PDF page with lines that are light gray.  When rendering the page as ImageType.BINARY the lines drops them out completely when the image rendered.  I have to render it as RBG first and make an extra call to convert to black and white which slow the process way down.  It seems the threshold value need to be manipulated but I'm not sure where one changes that at.

If grayscale would do, then use that instead. If you really do need a binary image then you'll get a better result by rendering in color or grayscale and then thresholding the image yourself. 

You'll also get better results if you render at a higher DPI (4x, 8x, 16x) and scale down the image with a high-quality algorithm such as Lanczos.

-- John

> -----Original Message-----
> From: Tilman Hausherr [mailto:THausherr@t-online.de] 
> Sent: Friday, June 26, 2015 3:51 PM
> To: users@pdfbox.apache.org
> Subject: Re: image Resolution
> 
> Why not just use the dpi parameter when rendering?
> 
> Tilman
> 
>> Am 26.06.2015 um 21:43 schrieb Kirk, Kenneth:
>> I'm sure this question has been asked before but I wasn't on the list when it was.  I have PDFs that I need to convert to images.  Most are 8.5x11.  Some are 8.5 x 3.5.  My problem is figuring out the resolution when I save them as 200dpi tiff images.  I made some assumptions that held true until I encountered PDFs that deviated from the those assumptions.  Although I can assume all PDFs are 8.5 inch wide and therefore I can deduce the resolution based of the width of the actually page I don't want to assume anything but calculate the resolution base on what I can get from the PDF structure itself.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> ************************************************
>> Disclaimer - This email and any files transmitted with it are confidential and contain privileged or copyright information. You must not present this message to another party without gaining permission from the sender. If you are not the intended recipient you must not copy, distribute or use this email or the information contained in it for any purpose other than to notify the Office of the Illinois Secretary of State.
>> 
>> If you have received this message in error, please notify the sender immediately, and delete this email from your system. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of the Office of the Illinois Secretary of State.
>> ************************************************
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ************************************************
> Disclaimer - This email and any files transmitted with it are confidential and contain privileged or copyright information. You must not present this message to another party without gaining permission from the sender. If you are not the intended recipient you must not copy, distribute or use this email or the information contained in it for any purpose other than to notify the Office of the Illinois Secretary of State. 
> 
> If you have received this message in error, please notify the sender immediately, and delete this email from your system. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of the Office of the Illinois Secretary of State. 
> ************************************************
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


RE: image Resolution

Posted by "Kirk, Kenneth" <Kk...@ILSOS.NET>.
Well after checking further I found that the problem was in the scaling after the image was created.  I wanting to scale it to 200 dpi using ImageIO and that is where the size discrepancy came about.  If I leave it at 72 dpi it's okay.  One other problem I having is generating a image from a PDF page with lines that are light gray.  When rendering the page as ImageType.BINARY the lines drops them out completely when the image rendered.  I have to render it as RBG first and make an extra call to convert to black and white which slow the process way down.  It seems the threshold value need to be manipulated but I'm not sure where one changes that at.

-----Original Message-----
From: Tilman Hausherr [mailto:THausherr@t-online.de] 
Sent: Friday, June 26, 2015 3:51 PM
To: users@pdfbox.apache.org
Subject: Re: image Resolution

Why not just use the dpi parameter when rendering?

Tilman

Am 26.06.2015 um 21:43 schrieb Kirk, Kenneth:
> I'm sure this question has been asked before but I wasn't on the list when it was.  I have PDFs that I need to convert to images.  Most are 8.5x11.  Some are 8.5 x 3.5.  My problem is figuring out the resolution when I save them as 200dpi tiff images.  I made some assumptions that held true until I encountered PDFs that deviated from the those assumptions.  Although I can assume all PDFs are 8.5 inch wide and therefore I can deduce the resolution based of the width of the actually page I don't want to assume anything but calculate the resolution base on what I can get from the PDF structure itself.
>
>
>
>
>
>
>
>
> ************************************************
> Disclaimer - This email and any files transmitted with it are confidential and contain privileged or copyright information. You must not present this message to another party without gaining permission from the sender. If you are not the intended recipient you must not copy, distribute or use this email or the information contained in it for any purpose other than to notify the Office of the Illinois Secretary of State.
>
> If you have received this message in error, please notify the sender immediately, and delete this email from your system. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of the Office of the Illinois Secretary of State.
> ************************************************
>
>
>
>
>
>
>
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org









************************************************
Disclaimer - This email and any files transmitted with it are confidential and contain privileged or copyright information. You must not present this message to another party without gaining permission from the sender. If you are not the intended recipient you must not copy, distribute or use this email or the information contained in it for any purpose other than to notify the Office of the Illinois Secretary of State. 

If you have received this message in error, please notify the sender immediately, and delete this email from your system. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of the Office of the Illinois Secretary of State. 
************************************************












---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: image Resolution

Posted by Tilman Hausherr <TH...@t-online.de>.
Why not just use the dpi parameter when rendering?

Tilman

Am 26.06.2015 um 21:43 schrieb Kirk, Kenneth:
> I'm sure this question has been asked before but I wasn't on the list when it was.  I have PDFs that I need to convert to images.  Most are 8.5x11.  Some are 8.5 x 3.5.  My problem is figuring out the resolution when I save them as 200dpi tiff images.  I made some assumptions that held true until I encountered PDFs that deviated from the those assumptions.  Although I can assume all PDFs are 8.5 inch wide and therefore I can deduce the resolution based of the width of the actually page I don't want to assume anything but calculate the resolution base on what I can get from the PDF structure itself.
>
>
>
>
>
>
>
>
> ************************************************
> Disclaimer - This email and any files transmitted with it are confidential and contain privileged or copyright information. You must not present this message to another party without gaining permission from the sender. If you are not the intended recipient you must not copy, distribute or use this email or the information contained in it for any purpose other than to notify the Office of the Illinois Secretary of State.
>
> If you have received this message in error, please notify the sender immediately, and delete this email from your system. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of the Office of the Illinois Secretary of State.
> ************************************************
>
>
>
>
>
>
>
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org