From 94d3f93a46b536678ad10513b595b75e2949b6fd Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 14 Aug 2022 11:05:09 +0100 Subject: [PATCH] add another low bitdepth png save test --- test/test-suite/test_foreign.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/test-suite/test_foreign.py b/test/test-suite/test_foreign.py index 11b997c6..92322bf7 100644 --- a/test/test-suite/test_foreign.py +++ b/test/test-suite/test_foreign.py @@ -410,6 +410,12 @@ class TestForeign: len_mono1 = len(self.mono.write_to_buffer(".png", bitdepth=1)) assert( len_mono1 < len_mono2 ) + # take a 1-bit image to png and back + onebit = self.mono > 128 + data = onebit.write_to_buffer(".png", bitdepth=1) + after = pyvips.Image.new_from_buffer(data, "") + assert( (onebit - after).abs().max() == 0 ) + # we can't test palette save since we can't be sure libimagequant is # available and there's no easy test for its presence