We’ve made a lot of improvements to our image decompression algorithms over the last few years. This allows Qoppa’s PDF libraries and components to open, render and print all types of images (JBIG2, CCIT Fax, JPEG, …) contained in PDF documents very reliably and in a very efficient way.

Unfortunately, there is still a hurdle with JPEG2000 images. Though we are able to render this type of images well, there are some performance issues. Currently (as of v2017R1), the full JPEG2000 image has to be stored in memory for rendering and so, depending on the size & resolution of the image, this can use up a lot of CPU and memory.

For example, find below memory use measurement for Qoppa PDF component jPDFNotes when displaying a PDF  document containing either a JPEG image or a JPEG2000 image.

JPEG300 DPI98Mb

Image Type Page Size  Resolution Memory Used by
jPDFNotes Sample Application*
JPEG A4 300 DPI 98Mb
JPEG A4 200 DPI 96Mb
JPEG2000 A4 300 DPi 822Mb
JPEG2000 A4 200 DPI 680Mb

* Memory use, as reported under the Windows Task Manager

You will notice that jPDFNotes is much more efficient at rendering a JPEG image than a JPEG2000 image.

The main reason is that our code currently has to keep the whole image in memory for JPEG2000 images, whereas it is able to access and paint JPEG images line by line. The line by line accessing and rendering approach is used for most image types and allows to handle “infinite size” images using only a very limited amount of memory.

Our plan is to improve the reading and rendering of JPEG2000 images in a future version to be as efficient as for other types of images.

In the meantime, as a workaround, we recommend that our customers make use of JPEG images instead of JPEG200 images whenever possible, when creating PDF documents that will need to be rendered in our PDF libraries or components. Otherwise, make sure to allocate enough memory to your application when rendering JPEG2000 images. Our sample applications have memory setting set to 768Mb (-Xmx768m) and are able to render A4 pages containing JPEG2000 images at 300DPI.

Tagged: