Image rendering issues on random pages (embedded reference viewer)  XML
Forum Index -> ICEpdf General
Author Message

Joined: 28/Nov/2017 02:00:14
Messages: 5

Hello everybody,

I’ve got a problem regarding image rendering. We use the imageReference property to improve readability on pdf documents that have been scanned at low resolution (worst case also in black/white mode).

It seems that the property e.g. imageReference=”blurred” is sometimes applied and sometime not. After zooming around the page gets rendered as expected. Only imageReference=“default” works consistently on the whole document.
Enclosed you will find some example data showing this effect.

Is there another property to force the usage of this rendering hint?
Can I do anything else to get this working?

Thanks for getting involved

Example 1:

Example 2:

Some environment information:
ICEpdf Version: 6.2.5
OS: Windows7x64 / Ubuntu 16.04 LTS
Java Version: 1.8
Image Codecs: CCITTFaxDecode / FlateDecode

System.getProperties().put("org.icepdf.core.nfont.truetype.hinting", "true");
System.getProperties().put("org.icepdf.core.imageReference", "blurred");
System.getProperties().put("org.icepdf.core.imagecache.enabled", false);
System.getProperties().put("org.icepdf.core.scaleImages", true);
System.getProperties().put("org.icepdf.core.paint.disableAlpha", false);
System.getProperties().put("org.icepdf.core.ccittfax.jai", true);
System.getProperties().put("org.icepdf.core.imageProxy", true);
System.getProperties().put("org.jpedal.jai", true);
System.getProperties().put("org.icepdf.core.awtFontLoading", true);
System.getProperties().put("org.icepdf.core.screen.render", "VALUE_RENDER_DEFAULT");
System.getProperties().put("org.icepdf.core.screen.stroke", "VALUE_STROKE_NORMALIZE");
System.getProperties().put("org.icepdf.core.screen.alphaInterpolation", "VALUE_INTERPOLATION_QUALITY");
System.getProperties().put("org.icepdf.core.screen.interpolation", "VALUE_INTERPOLATION_BILINEAR");
System.getProperties().put("org.icepdf.core.print.interpolation", "VALUE_INTERPOLATION_BILINEAR");
System.getProperties().put("org.icepdf.core.screen.antiAliasing", "VALUE_ANTIALIAS_ON");
System.getProperties().put("org.icepdf.core.screen.colorRender", "VALUE_COLOR_RENDER_QUALITY");
System.getProperties().put("org.icepdf.core.screen.dither", "VALUE_DITHER_ENABLE");
System.getProperties().put("org.icepdf.core.screen.fractionalmetrics", "VALUE_FRACTIONALMETRICS_ON");
System.getProperties().put("org.icepdf.core.screen.textAntiAliasing", true);
 Filename loremipsum1.pdf [Disk] Download
 Description Example1
 Filesize 391 Kbytes
 Downloaded:  945 time(s)

 Filename loremipsum2.pdf [Disk] Download
 Filesize 312 Kbytes
 Downloaded:  1021 time(s)


Joined: 26/Oct/2004 00:00:00
Messages: 1982

The files in question have quite a bit of variance with regards to image sizes. It's this variance that is causing the different rendering.

But that said the blurred image reference type has fall back code that will uses SmoothScaled if the image doesn't meet a min and max image size. This is the reason the images look so different from pages 1-5 of the first document. Page 1-4 meet the criteria for blurred and the last page hits the fallback SmoothScaled.

The Kernel dimension and min/max image size can be configured with the following system properties. The default are shown.

org.icepdf.core.imageReference.blurred.dimension= 3

If you are rendering a lot of content like then then I would recommend using smoothScaled over Blurred image references. You'll should get more consistent results. Alternatively you could change the min/max values to be larger to avoid using blur on images that are a little too small for the effect.

Joined: 28/Nov/2017 02:00:14
Messages: 5

Hello Patrick,

Thank you very much for your support.
Now I have much more clue how the different image rendering approaches work.
I’ve found the classes where the properties are used and get into some research. Very nice documented, readable code :-)

Using smoothScaled indeed leads to a much better result.
I have another pdf document (unfortunately confidential content), where the viewer renders the same page in different ways.
One time nicely smoothScaled and the other time the ‘default’ way. But…
When testing on 6.3-SNAPSHOT (trunk from November 28th) this behavior is mostly gone.
Only when zooming in and out by fast hurling the mouse wheel I can reproduce the effect.
I did not found a JIRA Task/Bug according to this. Maybe it was only a side effect of any other issue (memory?).

Do you remember such an issue between 6.2.5 and 6.3-SNAPSHOT?
Or can you make a guess, when version 6.3 would be released?

Kind Regards

Joined: 26/Oct/2004 00:00:00
Messages: 1982

Quite a bit of work has been done to improve our imaging pipeline for 6.3. The final release will also includes some jars which will further improve performance with regards to TIFF images.

I can see the scaling issue you are seeing being cause by on of the two issues. The first is that the scaled image references types do use more memory and in some cases with rapid repaints scaled image can't be created, especially if multiple pages are visible. More heap allocation can sometimes address this problem.

The second potential issue could be the image proxy which is enabled by default. The proxy can be disabled with -Dorg.icepdf.core.imageProxy=false. This can reduce the amount memory being used at anyone time as the proxy has two worker threads by default.

Right now it looks like 6.3 will be released in January. A European client has been a major sponsor for this release and we are working hard to finish up their enhancement. ICEpdf 6.3 will include major enhancement to our annotation creation tools. It's shaping up to be a significant release.

Joined: 28/Nov/2017 02:00:14
Messages: 5

That sounds very promising. Thank you for taking time.
Forum Index -> ICEpdf General
Go to:   
Powered by JForum 2.1.7ice © JForum Team