From c801db7a32312a2e75cf9766f38972d237b56ab8 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 15 Mar 2021 21:27:07 +1100 Subject: [PATCH] Added test for saving PNG with bits keyword --- Tests/test_file_png.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Tests/test_file_png.py b/Tests/test_file_png.py index 52ea3b6d2..c8d441485 100644 --- a/Tests/test_file_png.py +++ b/Tests/test_file_png.py @@ -625,6 +625,15 @@ class TestFilePng: with Image.open("Tests/images/hopper_idat_after_image_end.png") as im: assert im.text == {"TXT": "VALUE", "ZIP": "VALUE"} + def test_specify_bits(self, tmp_path): + im = hopper("P") + + out = str(tmp_path / "temp.png") + im.save(out, bits=4) + + with Image.open(out) as reloaded: + assert len(reloaded.png.im_palette[1]) == 48 + def test_exif(self): # With an EXIF chunk with Image.open("Tests/images/exif.png") as im: