Kieran France Kieran France is a programmer for IDRSolutions in charge of there internal test suite. In his spare time he enjoys tinkering with gadgets and code.

Screen rendering may not always be perfect

1 min read

Recently I have come to realize that Screen rendering may not always be perfect. Our tests have begun to show changes in their baseline even if run under identical conditions with identical code with no other obvious cause for the changes.

I should explain the basics of how the tests function. We use the Fest library to mimic user interaction with our viewer examples. Whilst Fest is doing this we take screenshots of the component that should be showing some behavior and compare this to a baseline of images that are known to show the correct output. This comparison is done by comparing the pixel colors between the generated output and the baseline.

A little while ago I moved my tests to a new test machine and upon setting up them up I found a slight problem. The tests are failing but the output appears correct when compared to our baseline. The reason the tests are failing is because it is detecting some pixels have changed although the difference in the RGB values can be anything as little as 1 on a single channel to up to 12 (and very rarely higher than this) on multiple channels. The most irritating thing about this is I can run the same code through the tests multiple times and get different sets of results.

In order to find what was wrong I activated some code that will alter the pixel color of any pixel that was of a different color such as Cyan or magenta as these are known not to appear within the output and are very easy to pick out. After running through the tests several times I found that although the output changed it was consistently appearing in the similar positions. The changes always appeared on images found on the PDF page and always at points where two different colors shared an edge. A further problem is that different images show the changes at different times, this means the tests are consistently showing change as when the baseline is updated with the changes to an image, the next time the tests are run these changes are no longer present or only present in certain images.

Unfortunately I have to leave this without a satisfying conclusion as I do not have any hard evidence as to what is causing this issue. Considering the fact that is only appears within images and not text, shapes or any other object within the PDF and that it only happens when the PDF is displayed on screen and not when it is rendered directly to an image I am leaning toward one possibility. It appears that screen rendering may be coming up with slightly different color values when an image is scaled and pixels are merged.

If anyone has ever experienced anything like this or wishes to know more feel free to leave a comment, I would be nice to hear from you.

Did you know...

IDRsolutions offers a whole range of online file converters to convert PDF and Microsoft Excel, Word and Office Documents to HTML5, SVG or image formats?

It is free to use for single file conversions and also includes Developer links if you want to use our commercial software for bulk conversions. Find out more on this page

Kieran France Kieran France is a programmer for IDRSolutions in charge of there internal test suite. In his spare time he enjoys tinkering with gadgets and code.

How to read HEIC image files in Java with…

In this article, I will explain how to read HEIC files into Java as a BufferedImage. ImageIO does not read HEIC file types so...
Mark Stephens
1 min read

How to convert WMF files to SVG in java…

This article will show you how to convert WMF files into SVG files using our JDeli Java Image library. What is WMF? WMF is...
Amy Pearson
1 min read

How to write WebP images in Java

In this article, I will walk you through how to write out images as WebP images in Java. ImageIO does not support WebP images...
Mark Stephens
1 min read

Leave a Reply

Your email address will not be published. Required fields are marked *

IDRsolutions Ltd 2020. All rights reserved.