screenshot: fix bug with Pillow when comparing two images with alpha channel
This commit is contained in:
parent
fa8db96601
commit
52c07a934c
|
@ -67,14 +67,17 @@ async def _diff_url(left: Browser, right: Browser, url: str, output_path: Path)
|
|||
|
||||
with NamedTemporaryFile(mode="wb") as left_file:
|
||||
left_file.write(left_bytes)
|
||||
left_image = Image.open(left_file.name)
|
||||
left_image = Image.open(left_file.name).convert('RGB')
|
||||
|
||||
with NamedTemporaryFile(mode="wb") as right_file:
|
||||
right_file.write(right_bytes)
|
||||
right_image = Image.open(right_file.name)
|
||||
right_image = Image.open(right_file.name).convert('RGB')
|
||||
|
||||
diff = ImageChops.difference(left_image, right_image)
|
||||
|
||||
if not diff.getbbox():
|
||||
return
|
||||
|
||||
url_slug = get_url_slug(url)
|
||||
if not output_path.is_dir():
|
||||
output_path.mkdir()
|
||||
|
|
Loading…
Reference in New Issue