From 215b61aadf5abf1120307b4efdb0c02164a1dc67 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Fri, 11 Oct 2013 23:39:16 -0700 Subject: [PATCH] added lab->srgb and srgb->lab->srgb tests --- Tests/test_imagecms.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Tests/test_imagecms.py b/Tests/test_imagecms.py index d244e1588..0725571f9 100644 --- a/Tests/test_imagecms.py +++ b/Tests/test_imagecms.py @@ -108,3 +108,25 @@ def test_lab_color(): target = Image.open('Tests/images/lena.Lab.tif') assert_image_similar(i, target, 1) + +def test_lab_srgb(): + pLab = ImageCms.createProfile("LAB") + t = ImageCms.buildTransform(pLab, SRGB, "LAB", "RGB") + + img = Image.open('Tests/images/lena.Lab.tif') + + img_srgb = ImageCms.applyTransform(img, t) + + assert_image_similar(lena(), img_srgb, 1) + +def test_lab_roundtrip(): + # check to see if we're at least internally consistent. + pLab = ImageCms.createProfile("LAB") + t = ImageCms.buildTransform(SRGB, pLab, "RGB", "LAB") + + t2 = ImageCms.buildTransform(pLab, SRGB, "LAB", "RGB") + + i = ImageCms.applyTransform(lena(), t) + out = ImageCms.applyTransform(i, t2) + + assert_image_similar(lena(), out, 2)