From 4ceff05db4d2c8a9c75b923474a2e9d342b05581 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 16 Dec 2024 19:39:27 +1100 Subject: [PATCH] Reduced epsilons --- Tests/test_file_avif.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Tests/test_file_avif.py b/Tests/test_file_avif.py index 1bc7299b62e..44585b4813e 100644 --- a/Tests/test_file_avif.py +++ b/Tests/test_file_avif.py @@ -147,7 +147,7 @@ def test_read(self) -> None: # generated with: # avifdec hopper.avif hopper_avif_write.png assert_image_similar_tofile( - image, "Tests/images/avif/hopper_avif_write.png", 12.0 + image, "Tests/images/avif/hopper_avif_write.png", 11.5 ) def _roundtrip(self, tmp_path: Path, mode: str, epsilon: float) -> None: @@ -163,7 +163,7 @@ def _roundtrip(self, tmp_path: Path, mode: str, epsilon: float) -> None: if mode == "RGB": # avifdec hopper.avif avif/hopper_avif_write.png assert_image_similar_tofile( - image, "Tests/images/avif/hopper_avif_write.png", 12.0 + image, "Tests/images/avif/hopper_avif_write.png", 5.81 ) # This test asserts that the images are similar. If the average pixel @@ -181,7 +181,7 @@ def test_write_rgb(self, tmp_path: Path) -> None: Does it have the bits we expect? """ - self._roundtrip(tmp_path, "RGB", 12.5) + self._roundtrip(tmp_path, "RGB", 8.41) def test_AvifEncoder_with_invalid_args(self) -> None: """ @@ -574,7 +574,7 @@ def test_p_mode_transparency(self) -> None: im_png.save(buf_out, format="AVIF", quality=100) with Image.open(buf_out) as expected: - assert_image_similar(im_png.convert("RGBA"), expected, 1) + assert_image_similar(im_png.convert("RGBA"), expected, 0.17) def test_decoder_strict_flags(self) -> None: # This would fail if full avif strictFlags were enabled @@ -633,10 +633,10 @@ def test_write_animation_L(self, tmp_path: Path) -> None: assert im.n_frames == orig.n_frames # Compare first and second-to-last frames to the original animated GIF - assert_image_similar(im.convert("RGB"), orig.convert("RGB"), 25.0) + assert_image_similar(im.convert("RGB"), orig.convert("RGB"), 2.25) orig.seek(orig.n_frames - 2) im.seek(im.n_frames - 2) - assert_image_similar(im.convert("RGB"), orig.convert("RGB"), 25.0) + assert_image_similar(im.convert("RGB"), orig.convert("RGB"), 2.54) def test_write_animation_RGB(self, tmp_path: Path) -> None: """ @@ -649,11 +649,11 @@ def check(temp_file: str) -> None: assert im.n_frames == 4 # Compare first frame to original - assert_image_similar(im, frame1.convert("RGBA"), 25.0) + assert_image_similar(im, frame1.convert("RGBA"), 2.7) # Compare second frame to original im.seek(1) - assert_image_similar(im, frame2.convert("RGBA"), 25.0) + assert_image_similar(im, frame2.convert("RGBA"), 4.1) with self.star_frames() as frames: frame1 = frames[0]