From 1c3932e89ff2e1512fc00b52ef518c7fa87818ab Mon Sep 17 00:00:00 2001 From: wiredfool Date: Thu, 10 Oct 2013 23:27:34 -0700 Subject: [PATCH] Added LAB mode, core dumped --- PIL/Image.py | 2 ++ Tests/test_imagecms.py | 6 +++--- _imagingcms.c | 3 +++ libImaging/Imaging.h | 1 + libImaging/Pack.c | 6 ++++++ libImaging/Storage.c | 8 +++++++- 6 files changed, 22 insertions(+), 4 deletions(-) diff --git a/PIL/Image.py b/PIL/Image.py index 56a4b7093..9c92bf98f 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -200,6 +200,7 @@ _MODEINFO = { "RGBA": ("RGB", "L", ("R", "G", "B", "A")), "CMYK": ("RGB", "L", ("C", "M", "Y", "K")), "YCbCr": ("RGB", "L", ("Y", "Cb", "Cr")), + "LAB": ("RGB", "L", ("L", "A", "B")), # Experimental modes include I;16, I;16L, I;16B, RGBa, BGR;15, and # BGR;24. Use these modes only if you know exactly what you're @@ -224,6 +225,7 @@ _MODE_CONV = { "RGBA": ('|u1', 4), "CMYK": ('|u1', 4), "YCbCr": ('|u1', 3), + "LAB": ('|u1', 3), "I;16": ('=u2', None), "I;16B": ('>u2', None), "I;16L": ('pixelsize = 4; im->linesize = xsize * 4; + } else if (strcmp(mode, "LAB") == 0) { + /* 24-bit color, luminance, + 2 color channels */ + im->bands = 3; + im->pixelsize = 4; + im->linesize = xsize * 4; + } else { free(im); - return (Imaging) ImagingError_ValueError("unrecognized mode"); + return (Imaging) ImagingError_ValueError("unrecognized mode"); } /* Setup image descriptor */