Image Comparison Recommendations

4.1.3 Image Comparison Recommendations

Reliability of most image comparison methods decreases with factors which produce image differences on the pixel level. To minimize these impacts consider the following hints:

  • Change the remote desktop background to a solid colour. Choose such a colour which is not contained in the application window which you are going to test. This will ensure that the template images that contain the background will not fail in another environment. It is also likely to make your scripts faster (fewer colours usually improve the performance of image comparison methods.
  • Change in the environment or display settings also affect the functionality of image comparison. If you create your templates on a 24-bit colour remote desktop and later on restart the VNC server in the 8-bit colour depth, it won't work.
  • If the mouse pointer is rendered as part of the desktop image (meaning that the pointer remains visible even if you move the local mouse pointer out of the desktop view) it is a good practice to use the Mouse move command to move your mouse pointer to a constant position before comparison. Also, make sure that the mouse pointer is not on your template images!
  • Do not perform image comparison against images with lossy compression such as JPEG. Though the tool will complain initially, it will finally let you do it (though the comparison will most likely fail due to too many mismatching pixels). PNG and BMP formats are preferred because they preserve 100% of the image information and guarantee reliable and stable comparison results. GIF is generally also a good one; be however aware that its palette is limited to 256 colours and many tools flatten the colours when they don't meet the limit. It is recommended to retest (compare) a GIF template against a desktop image right after it is created to make sure it works correctly.
  • Some systems and applications tend to highlight buttons and menu items when the mouse pointer is above them. You may then want to create two templates, one for regular and another one for the highlighted state and use them as a template list for all applicable image searches.