From 49652eeca162ade0e61a7a85798e7f77095ee7a6 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Wed, 20 Mar 2024 20:34:38 +1100 Subject: [PATCH] Added conversion from RGB to RGBa and La --- Tests/helper.py | 6 +----- src/libImaging/Convert.c | 2 ++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Tests/helper.py b/Tests/helper.py index a7691f64527..9849bf65565 100644 --- a/Tests/helper.py +++ b/Tests/helper.py @@ -261,11 +261,7 @@ def hopper(mode: str | None = None, cache: dict[str, Image.Image] = {}) -> Image # (for fast, isolated, repeatable tests). im = cache.get(mode) if im is None: - if mode == "RGBa": - im = hopper("RGBA").convert(mode) - elif mode == "La": - im = hopper("LA").convert(mode) - elif mode == "F": + if mode == "F": im = hopper("L").convert(mode) elif mode[:4] == "I;16": im = hopper("I").convert(mode) diff --git a/src/libImaging/Convert.c b/src/libImaging/Convert.c index 5cc39cd0019..0cb39b16997 100644 --- a/src/libImaging/Convert.c +++ b/src/libImaging/Convert.c @@ -940,12 +940,14 @@ static struct { {"RGB", "1", rgb2bit}, {"RGB", "L", rgb2l}, + {"RGB", "La", rgb2la}, {"RGB", "LA", rgb2la}, {"RGB", "I", rgb2i}, {"RGB", "F", rgb2f}, {"RGB", "BGR;15", rgb2bgr15}, {"RGB", "BGR;16", rgb2bgr16}, {"RGB", "BGR;24", rgb2bgr24}, + {"RGB", "RGBa", rgb2rgba}, {"RGB", "RGBA", rgb2rgba}, {"RGB", "RGBX", rgb2rgba}, {"RGB", "CMYK", rgb2cmyk},