mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-13 01:05:48 +03:00
Support reading grayscale images with 4 channels
This commit is contained in:
parent
bcdb688233
commit
92cc9bf902
|
@ -313,6 +313,18 @@ def test_rgba(ext: str) -> None:
|
|||
assert im.mode == "RGBA"
|
||||
|
||||
|
||||
def test_grayscale_four_channels() -> None:
|
||||
with open("Tests/images/rgb_trns_ycbc.jp2", "rb") as fp:
|
||||
data = fp.read()
|
||||
|
||||
# Change color space to OPJ_CLRSPC_GRAY
|
||||
data = data[:76] + b"\x11" + data[77:]
|
||||
|
||||
with Image.open(BytesIO(data)) as im:
|
||||
im.load()
|
||||
assert im.mode == "RGBA"
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
not os.path.exists(EXTRA_DIR), reason="Extra image files not installed"
|
||||
)
|
||||
|
|
|
@ -615,6 +615,7 @@ static const struct j2k_decode_unpacker j2k_unpackers[] = {
|
|||
{"RGBA", OPJ_CLRSPC_GRAY, 2, 0, j2ku_graya_la},
|
||||
{"RGBA", OPJ_CLRSPC_SRGB, 3, 1, j2ku_srgb_rgb},
|
||||
{"RGBA", OPJ_CLRSPC_SYCC, 3, 1, j2ku_sycc_rgb},
|
||||
{"RGBA", OPJ_CLRSPC_GRAY, 4, 1, j2ku_srgba_rgba},
|
||||
{"RGBA", OPJ_CLRSPC_SRGB, 4, 1, j2ku_srgba_rgba},
|
||||
{"RGBA", OPJ_CLRSPC_SYCC, 4, 1, j2ku_sycca_rgba},
|
||||
{"CMYK", OPJ_CLRSPC_CMYK, 4, 1, j2ku_srgba_rgba},
|
||||
|
|
Loading…
Reference in New Issue
Block a user