fixed #627 env vars lost in Popen processes

This commit is contained in:
k4yt3x
2022-04-09 18:40:43 +00:00
parent f976bdc1c9
commit afca10a17b
6 changed files with 75 additions and 2 deletions

18
tests/utils.py Normal file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from PIL import Image, ImageChops, ImageStat
def get_image_diff(image0: Image.Image, image1: Image.Image) -> float:
"""
calculate the percentage of differences between two images
:param image0 Image.Image: the first frame
:param image1 Image.Image: the second frame
:rtype float: the percent difference between the two images
"""
difference = ImageChops.difference(image0, image1)
difference_stat = ImageStat.Stat(difference)
percent_diff = sum(difference_stat.mean) / (len(difference_stat.mean) * 255) * 100
return percent_diff