如何比较截图与更改预期精度的截图? [英] How to compare screenshots with ashot changing the expected precision?

查看:165
本文介绍了如何比较截图与更改预期精度的截图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Ashot与Selenium结合使用,将网页生成的画布图与系统中保存的图像进行比较.我们已经使用ashot API生成了此保存的图像以进行进一步的比较,从而避免了将来的差异.

I'm using Ashot with Selenium to compare a canvas graph generated by a web page with an image saved in the system. We've used the ashot API to generate this saved image for further comparison, avoiding differences in the future.

但是在我们的团队中,有使用Windows的开发人员,有使用Linux的开发人员,甚至使用相同的浏览器版本,呈现的图形也略有不同(颜色强度,字体呈现),而图的比较(使用ImageDiffer.makeDiff())由于这些渲染差异,这两个图像在不同的OS上导致不同的结果(我想是问题所在).

But in my team there are developers that use Windows, others that use Linux and, even using the same browser version, the graph rendered is slightly different (color strength, font rendering) and the comparison (using ImageDiffer.makeDiff()) of the two images results in different results in different OS's because of those render differences (I guess the problem is it).

有什么办法可以忽略Ashot而忽略这两个小的差异来比较两个图像吗?我的意思是:要更改比较的精度吗?

Is there any way to compare the two images with Ashot ignoring those small differences? I mean: changing the precision of comparison?

推荐答案

罗布森!您可能正在寻找此选项withDiffSizeTrigger. 设置仍认为图像相同时的最大可分辨像素数.

Robson! You probably are looking for this option withDiffSizeTrigger. It sets the maximum number of distinguished pixels when images are still considered the same.

看看例如:

ImageDiff diff = new ImageDiffer().makeDiff(expected, actual).withDiffSizeTrigger(__numbers_of_pixels__)

这篇关于如何比较截图与更改预期精度的截图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆