diff --git a/Tests/test_image_mode.py b/Tests/test_image_mode.py index 0232a5536..670b2f4eb 100644 --- a/Tests/test_image_mode.py +++ b/Tests/test_image_mode.py @@ -21,6 +21,7 @@ def test_sanity(): assert m.bands == ("1",) assert m.basemode == "L" assert m.basetype == "L" + assert m.typestr == "|b1" for mode in ( "I;16", @@ -45,6 +46,7 @@ def test_sanity(): assert m.bands == ("R", "G", "B") assert m.basemode == "RGB" assert m.basetype == "L" + assert m.typestr == "|u1" def test_properties(): diff --git a/src/PIL/Image.py b/src/PIL/Image.py index ef27d6145..2977cfd38 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -208,44 +208,14 @@ if sys.byteorder == "little": else: _ENDIAN = ">" -_MODE_CONV = { - # official modes - "1": "|b1", # Bits need to be extended to bytes - "L": "|u1", - "LA": "|u1", - "I": _ENDIAN + "i4", - "F": _ENDIAN + "f4", - "P": "|u1", - "RGB": "|u1", - "RGBX": "|u1", - "RGBA": "|u1", - "CMYK": "|u1", - "YCbCr": "|u1", - "LAB": "|u1", # UNDONE - unsigned |u1i1i1 - "HSV": "|u1", - # I;16 == I;16L, and I;32 == I;32L - "I;16": "u2", - "I;16L": "i2", - "I;16LS": "u4", - "I;32L": "i4", - "I;32LS": "u2", + "I;16BS": ">i2", + "I;16N": Image._ENDIAN + "u2", + "I;16NS": Image._ENDIAN + "i2", + "I;32": "u4", + "I;32L": "i4", + "I;32LS": "