diff --git a/Tests/test_lib_pack.py b/Tests/test_lib_pack.py index b4c8b6a56..e33d2c750 100644 --- a/Tests/test_lib_pack.py +++ b/Tests/test_lib_pack.py @@ -240,6 +240,7 @@ class TestLibUnpack(PillowTestCase): self.assert_unpack("RGB", "RGB", 3, (1,2,3), (4,5,6), (7,8,9)) self.assert_unpack("RGB", "RGB;L", 3, (1,4,7), (2,5,8), (3,6,9)) self.assert_unpack("RGB", "RGB;R", 3, (128,64,192), (32,160,96)) + self.assert_unpack("RGB", "RGB;16L", 6, (2,4,6), (8,10,12)) self.assert_unpack("RGB", "RGB;16B", 6, (1,3,5), (7,9,11)) self.assert_unpack("RGB", "BGR", 3, (3,2,1), (6,5,4), (9,8,7)) self.assert_unpack("RGB", "RGB;15", 2, (8,131,0), (24,0,8)) @@ -267,6 +268,10 @@ class TestLibUnpack(PillowTestCase): (1,2,3,4), (5,6,7,8), (9,10,11,12)) self.assert_unpack("RGBA", "RGBa", 4, (63,127,191,4), (159,191,223,8), (191,212,233,12)) + self.assert_unpack("RGBA", "RGBa;16L", 8, + (63,127,191,8), (159,191,223,16), (191,212,233,24)) + self.assert_unpack("RGBA", "RGBa;16B", 8, + (36,109,182,7), (153,187,221,15), (188,210,232,23)) self.assert_unpack("RGBA", "BGRa", 4, (191,127,63,4), (223,191,159,8), (233,212,191,12)) self.assert_unpack("RGBA", "RGBA;I", 4, @@ -276,6 +281,7 @@ class TestLibUnpack(PillowTestCase): self.assert_unpack("RGBA", "RGBA;15", 2, (8,131,0,0), (24,0,8,0)) self.assert_unpack("RGBA", "BGRA;15", 2, (0,131,8,0), (8,0,24,0)) self.assert_unpack("RGBA", "RGBA;4B", 2, (17,0,34,0), (51,0,68,0)) + self.assert_unpack("RGBA", "RGBA;16L", 8, (2,4,6,8), (10,12,14,16)) self.assert_unpack("RGBA", "RGBA;16B", 8, (1,3,5,7), (9,11,13,15)) self.assert_unpack("RGBA", "BGRA", 4, (3,2,1,4), (7,6,5,8), (11,10,9,12)) @@ -313,6 +319,8 @@ class TestLibUnpack(PillowTestCase): (1,2,3,4), (5,6,7,8), (9,10,11,12)) self.assert_unpack("RGBX", "RGBX;L", 4, (1,4,7,10), (2,5,8,11), (3,6,9,12)) + self.assert_unpack("RGBX", "RGBX;16L", 8, (2,4,6,8), (10,12,14,16)) + self.assert_unpack("RGBX", "RGBX;16B", 8, (1,3,5,7), (9,11,13,15)) self.assert_unpack("RGBX", "BGRX", 4, (3,2,1,X), (7,6,5,X), (11,10,9,X)) self.assert_unpack("RGBX", "XRGB", 4, (2,3,4,X), (6,7,8,X), (10,11,12,X)) self.assert_unpack("RGBX", "XBGR", 4, (4,3,2,X), (8,7,6,X), (12,11,10,X)) diff --git a/libImaging/Unpack.c b/libImaging/Unpack.c index 42b309e7f..a061beff9 100644 --- a/libImaging/Unpack.c +++ b/libImaging/Unpack.c @@ -1320,9 +1320,9 @@ static struct { {"RGBA", "LA", 16, unpackRGBALA}, {"RGBA", "LA;16B", 32, unpackRGBALA16B}, {"RGBA", "RGBA", 32, copy4}, + {"RGBA", "RGBa", 32, unpackRGBa}, {"RGBA", "RGBa;16L", 64, unpackRGBa16L}, {"RGBA", "RGBa;16B", 64, unpackRGBa16B}, - {"RGBA", "RGBa", 32, unpackRGBa}, {"RGBA", "BGRa", 32, unpackBGRa}, {"RGBA", "RGBA;I", 32, unpackRGBAI}, {"RGBA", "RGBA;L", 32, unpackRGBAL}, @@ -1356,9 +1356,9 @@ static struct { {"RGBX", "RGB;4B", 16, ImagingUnpackRGB4B}, {"RGBX", "BGR;5", 16, ImagingUnpackBGR15}, /* compat */ {"RGBX", "RGBX", 32, copy4}, + {"RGBX", "RGBX;L", 32, unpackRGBAL}, {"RGBX", "RGBX;16L", 64, unpackRGBA16L}, {"RGBX", "RGBX;16B", 64, unpackRGBA16B}, - {"RGBX", "RGBX;L", 32, unpackRGBAL}, {"RGBX", "BGRX", 32, ImagingUnpackBGRX}, {"RGBX", "XRGB", 24, ImagingUnpackXRGB}, {"RGBX", "XBGR", 32, ImagingUnpackXBGR},