def test_profile_tobytes(self): i = Image.open("Tests/images/rgb.jpg") p = ImageCms.getOpenProfile(BytesIO(i.info["icc_profile"])) p2 = ImageCms.getOpenProfile(BytesIO(p.tobytes())) # not the same bytes as the original icc_profile, # but it does roundtrip self.assertEqual(p.tobytes(), p2.tobytes()) self.assertEqual(ImageCms.getProfileName(p), ImageCms.getProfileName(p2)) self.assertEqual(ImageCms.getProfileDescription(p), ImageCms.getProfileDescription(p2))
def test_extensions(self): # extensions i = Image.open("Tests/images/rgb.jpg") p = ImageCms.getOpenProfile(BytesIO(i.info["icc_profile"])) self.assertEqual( ImageCms.getProfileName(p).strip(), 'IEC 61966-2.1 Default RGB colour space - sRGB')
def test_name(self): self.skip_missing() # get profile information for file self.assertEqual( ImageCms.getProfileName(SRGB).strip(), 'IEC 61966-2-1 Default RGB Colour Space - sRGB')