dougnoel / sentinel

A Selenium/Appium framework that enables users to focus on automating web and windows tests, so that automated tests can be written in a non-technical way in the same amount of time as manual tests can be executed.
Apache License 2.0
11 stars 13 forks source link

Switch logging and image comparison to using WebP (Lossless preferred for image comparison) #286

Open tyBouch opened 2 years ago

tyBouch commented 2 years ago

The WebP format is an open source image format produced by, or with the aid, of google. It utilizes VP8/VP9 video compression. Currently it supports a high quality lossy and lossless mode with better compression and quality than JPEG or PNG while offering both modes depending on libraries used.

This should fit both scenarios either by using lossless for all cases, or supporting lossless for 1:1 comparisons (such as the color code fetch for windows) with lossy utilized for logging.

Jpeg XL or AVIF, designed to supersede it, are also options, but JPEG XL has no browser support, and AVIF lacks support in edge, safari, and opera.

https://developers.google.com/speed/webp/

ImageIO currently does not have support for webp, but support can be added with plugins such as: https://github.com/sejda-pdf/webp-imageio

Alternatively third party libraries have support: https://www.idrsolutions.com/jdeli/

Alternatively, as webp libraries aren't the most common outside web deployment, I'd recommend we use PNG for image comparison and use jpeg for logging to prevent compression artifacts from messing with the comparison.

tyBouch commented 1 year ago

@pturchinetz

This would apply to you more now than myself. WebP would allow smaller than PNG sizes, and is becoming better supported. That said, it's still not supported by windows image viewer. Still something to look out for. Biggest thing to look out for, though, is it allows a lossless or lossy mode, and lossy would be invalid for comparison more than likely.