mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-24 17:06:16 +03:00
tests for icc profile in png
This commit is contained in:
parent
989e162ff6
commit
1a6c6b1250
BIN
Tests/images/icc_profile.png
Normal file
BIN
Tests/images/icc_profile.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
|
@ -434,26 +434,36 @@ class TestFilePng(PillowTestCase):
|
|||
|
||||
self.assertEqual(im.info["transparency"], 0)
|
||||
|
||||
def test_save_icc_profile_none(self):
|
||||
# check saving files with an ICC profile set to None (omit profile)
|
||||
in_file = "Tests/images/icc_profile_none.png"
|
||||
im = Image.open(in_file)
|
||||
def test_save_icc_profile(self):
|
||||
im = Image.open("Tests/images/icc_profile_none.png")
|
||||
self.assertEqual(im.info['icc_profile'], None)
|
||||
|
||||
with_icc = Image.open("Tests/images/icc_profile.png")
|
||||
expected_icc = with_icc.info['icc_profile']
|
||||
|
||||
im = roundtrip(im, icc_profile=expected_icc)
|
||||
self.assertEqual(im.info['icc_profile'], expected_icc)
|
||||
|
||||
def test_discard_icc_profile(self):
|
||||
im = Image.open('Tests/images/icc_profile.png')
|
||||
|
||||
im = roundtrip(im, icc_profile=None)
|
||||
self.assertNotIn('icc_profile', im.info)
|
||||
|
||||
def test_roundtrip_icc_profile(self):
|
||||
im = Image.open('Tests/images/icc_profile.png')
|
||||
expected_icc = im.info['icc_profile']
|
||||
|
||||
im = roundtrip(im)
|
||||
self.assertEqual(im.info['icc_profile'], expected_icc)
|
||||
|
||||
def test_roundtrip_no_icc_profile(self):
|
||||
im = Image.open("Tests/images/icc_profile_none.png")
|
||||
self.assertEqual(im.info['icc_profile'], None)
|
||||
|
||||
im = roundtrip(im)
|
||||
self.assertNotIn('icc_profile', im.info)
|
||||
|
||||
def test_roundtrip_icc_profile(self):
|
||||
# check that we can roundtrip the icc profile
|
||||
im = hopper('RGB')
|
||||
|
||||
jpeg_image = Image.open('Tests/images/flower2.jpg')
|
||||
expected_icc = jpeg_image.info['icc_profile']
|
||||
|
||||
im.info['icc_profile'] = expected_icc
|
||||
im = roundtrip(im)
|
||||
self.assertEqual(im.info['icc_profile'], expected_icc)
|
||||
|
||||
def test_repr_png(self):
|
||||
im = hopper()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user