Re: Rendering an image at a lower resolution
Am 23.02.2018 um 08:31 schrieb Itai: Hi, I'm trying to use PDFBox to show a preview of some PDFs containing very large images (typically tens of thousands of pixels a side). It seems PDFRenderer uses PDImage#toImage, which creates a BufferedImage at the full resolution, regardless of the DPI or scale requested by PDFRenderer. This causes an issue, as the resulting BufferedImage is often too large to fit in memory (>8GB), causing an OOM error. Is there a way to get a scaled BufferedImage at a lower quality, without first having to render/produce a full-resolution BufferedImage? No If not - where would I start if I needed to add such a feature? You could grab the source code and look at it... that isn't so easy. You could look at SampledImageReader and debug from there. The problem is that this class wouldn't know that a "smaller" image is needed. Tilman - To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org
Re: Rendering an image at a lower resolution
I have the same issue, while trying to just render images in AWS lambda (where there is limited memory available). So if there was a way to make this work, it would be great. On 2018/02/23 07:31:31, Itaiwrote: > Hi,> > > I'm trying to use PDFBox to show a preview of some PDFs containing very> > large images (typically tens of thousands of pixels a side).> > It seems PDFRenderer uses PDImage#toImage, which creates a BufferedImage at> > the full resolution, regardless of the DPI or scale requested by> > PDFRenderer.> > This causes an issue, as the resulting BufferedImage is often too large to> > fit in memory (>8GB), causing an OOM error.> > > Is there a way to get a scaled BufferedImage at a lower quality, without> > first having to render/produce a full-resolution BufferedImage?> > > If not - where would I start if I needed to add such a feature?> > > Thanks,> > Itai.> > - To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org