From 89443ae9506f4f494876a7980f2295e278c031b5 Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Mon, 20 Feb 2017 12:28:13 -0800 Subject: [PATCH] B/W images don't save properly in QT4 either --- Tests/test_image_toqimage.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Tests/test_image_toqimage.py b/Tests/test_image_toqimage.py index 3e2aa9dd6..5afb9a9f4 100644 --- a/Tests/test_image_toqimage.py +++ b/Tests/test_image_toqimage.py @@ -40,8 +40,8 @@ class TestToQImage(PillowQtTestCase, PillowTestCase): else: self.assert_image_equal(rt, src) - if QT_VERSION == 5 and mode == '1': - # this combination appears to not save correctly + if mode == '1': + # BW appears to not save correctly on QT4 and QT5 # kicks out errors on console: # libpng warning: Invalid color type/bit depth combination in IHDR # libpng error: Invalid IHDR data @@ -53,6 +53,10 @@ class TestToQImage(PillowQtTestCase, PillowTestCase): # Check that it actually worked. reloaded = Image.open(tempfile) + # Gray images appear to come back in palette mode. + # They're roughly equivalent + if QT_VERSION == 4 and mode == 'L': + src = src.convert('P') self.assert_image_equal(reloaded, src)