diff --git a/Tests/icc/CMY.icm b/Tests/icc/CMY.icm deleted file mode 100644 index acc71ddd9..000000000 Binary files a/Tests/icc/CMY.icm and /dev/null differ diff --git a/Tests/icc/LICENSE.txt b/Tests/icc/LICENSE.txt new file mode 100644 index 000000000..e6ec6a69f --- /dev/null +++ b/Tests/icc/LICENSE.txt @@ -0,0 +1,25 @@ +from http://www.color.org/srgbprofiles.xalter + +Terms of use + +To anyone who acknowledges that the file "sRGB_v4_ICC_preference.icc" +is provided "AS IS" WITH NO EXPRESS OR IMPLIED WARRANTY, permission +to use, copy and distribute this file for any purpose is hereby +granted without fee, provided that the file is not changed including +the ICC copyright notice tag, and that the name of ICC shall not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. ICC makes no +representations about the suitability of this software for any +purpose. + + +To anyone who acknowledges that the file +"sRGB_IEC61966-2-1_blackscaled.icc" is provided "AS IS" WITH NO +EXPRESS OR IMPLIED WARRANTY, permission to use, copy and distribute +these file for any purpose is hereby granted without fee, provided +that the file is not changed including the ICC copyright notice tag, +and that the name of ICC shall not be used in advertising or publicity +pertaining to distribution of the software without specific, written +prior permission. ICC makes no representations about the suitability +of this software for any purpose. + diff --git a/Tests/icc/YCC709.icm b/Tests/icc/YCC709.icm deleted file mode 100644 index d9f5a5a5d..000000000 Binary files a/Tests/icc/YCC709.icm and /dev/null differ diff --git a/Tests/icc/sRGB.icm b/Tests/icc/sRGB_IEC61966-2-1_black_scaled.icc similarity index 63% rename from Tests/icc/sRGB.icm rename to Tests/icc/sRGB_IEC61966-2-1_black_scaled.icc index 7f9d18d09..71e338302 100644 Binary files a/Tests/icc/sRGB.icm and b/Tests/icc/sRGB_IEC61966-2-1_black_scaled.icc differ diff --git a/Tests/icc/sRGB_v4_ICC_preference.icc b/Tests/icc/sRGB_v4_ICC_preference.icc new file mode 100644 index 000000000..cfbd03e1f Binary files /dev/null and b/Tests/icc/sRGB_v4_ICC_preference.icc differ diff --git a/Tests/test_imagecms.py b/Tests/test_imagecms.py index e05bdcb20..f35b6bd2f 100644 --- a/Tests/test_imagecms.py +++ b/Tests/test_imagecms.py @@ -3,7 +3,8 @@ from helper import unittest, PillowTestCase, hopper, lena from PIL import Image from io import BytesIO - +import os + try: from PIL import ImageCms from PIL.ImageCms import ImageCmsProfile @@ -13,8 +14,8 @@ except ImportError as v: pass -SRGB = "Tests/icc/sRGB.icm" - +SRGB = "Tests/icc/sRGB_IEC61966-2-1_black_scaled.icc" +HAVE_PROFILE = os.path.exists(SRGB) class TestImageCms(PillowTestCase): @@ -26,8 +27,12 @@ class TestImageCms(PillowTestCase): except ImportError as v: self.skipTest(v) - def test_sanity(self): + def skip_missing(self): + if not HAVE_PROFILE: + self.skipTest("SRGB profile not available") + def test_sanity(self): + # basic smoke test. # this mostly follows the cms_test outline. @@ -38,6 +43,7 @@ class TestImageCms(PillowTestCase): # internal version number self.assertRegexpMatches(ImageCms.core.littlecms_version, "\d+\.\d+$") + self.skip_missing() i = ImageCms.profileToProfile(hopper(), SRGB, SRGB) self.assert_image(i, "RGB", (128, 128)) @@ -70,38 +76,45 @@ class TestImageCms(PillowTestCase): hopper().point(t) 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') + 'IEC 61966-2-1 Default RGB Colour Space - sRGB') def test_info(self): + self.skip_missing() self.assertEqual( ImageCms.getProfileInfo(SRGB).splitlines(), [ - 'sRGB IEC61966-2.1', '', - 'Copyright (c) 1998 Hewlett-Packard Company', '']) + 'sRGB IEC61966-2-1 black scaled', '', + 'Copyright International Color Consortium, 2009', '']) def test_copyright(self): + self.skip_missing() self.assertEqual( ImageCms.getProfileCopyright(SRGB).strip(), - 'Copyright (c) 1998 Hewlett-Packard Company') + 'Copyright International Color Consortium, 2009') def test_manufacturer(self): + self.skip_missing() self.assertEqual( ImageCms.getProfileManufacturer(SRGB).strip(), - 'IEC http://www.iec.ch') + '') def test_model(self): + self.skip_missing() self.assertEqual( ImageCms.getProfileModel(SRGB).strip(), - 'IEC 61966-2.1 Default RGB colour space - sRGB') + 'IEC 61966-2-1 Default RGB Colour Space - sRGB') def test_description(self): + self.skip_missing() self.assertEqual( ImageCms.getProfileDescription(SRGB).strip(), - 'sRGB IEC61966-2.1') + 'sRGB IEC61966-2-1 black scaled') def test_intent(self): + self.skip_missing() self.assertEqual(ImageCms.getDefaultIntent(SRGB), 0) self.assertEqual(ImageCms.isIntentSupported( SRGB, ImageCms.INTENT_ABSOLUTE_COLORIMETRIC, @@ -139,6 +152,7 @@ class TestImageCms(PillowTestCase): self.assertRaises( ImageCms.PyCMSError, lambda: ImageCms.getProfileName(None)) + self.skip_missing() self.assertRaises( ImageCms.PyCMSError, lambda: ImageCms.isIntentSupported(SRGB, None, None)) @@ -153,9 +167,9 @@ class TestImageCms(PillowTestCase): def test_simple_lab(self): i = Image.new('RGB', (10, 10), (128, 128, 128)) - + psRGB = ImageCms.createProfile("sRGB") pLab = ImageCms.createProfile("LAB") - t = ImageCms.buildTransform(SRGB, pLab, "RGB", "LAB") + t = ImageCms.buildTransform(psRGB, pLab, "RGB", "LAB") i_lab = ImageCms.applyTransform(i, t) @@ -174,8 +188,9 @@ class TestImageCms(PillowTestCase): self.assertEqual(list(b), [128] * 100) def test_lab_color(self): + psRGB = ImageCms.createProfile("sRGB") pLab = ImageCms.createProfile("LAB") - t = ImageCms.buildTransform(SRGB, pLab, "RGB", "LAB") + t = ImageCms.buildTransform(psRGB, pLab, "RGB", "LAB") # Need to add a type mapping for some PIL type to TYPE_Lab_8 in # findLCMSType, and have that mapping work back to a PIL mode # (likely RGB). @@ -189,8 +204,9 @@ class TestImageCms(PillowTestCase): self.assert_image_similar(i, target, 30) def test_lab_srgb(self): + psRGB = ImageCms.createProfile("sRGB") pLab = ImageCms.createProfile("LAB") - t = ImageCms.buildTransform(pLab, SRGB, "LAB", "RGB") + t = ImageCms.buildTransform(pLab, psRGB, "LAB", "RGB") img = Image.open('Tests/images/lena.Lab.tif') @@ -206,10 +222,11 @@ class TestImageCms(PillowTestCase): def test_lab_roundtrip(self): # check to see if we're at least internally consistent. + psRGB = ImageCms.createProfile("sRGB") pLab = ImageCms.createProfile("LAB") - t = ImageCms.buildTransform(SRGB, pLab, "RGB", "LAB") + t = ImageCms.buildTransform(psRGB, pLab, "RGB", "LAB") - t2 = ImageCms.buildTransform(pLab, SRGB, "LAB", "RGB") + t2 = ImageCms.buildTransform(pLab, psRGB, "LAB", "RGB") i = ImageCms.applyTransform(hopper(), t)