diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 41a0d345f8f..99ede4d486c 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -441,12 +441,14 @@ def _getdecoder( elif not isinstance(args, tuple): args = (args,) - if decoder_name == "raw" and args[0] in _DEPRECATED_RAWMODES: - deprecate( - f"rawmode {args[0]}", - 12, - replacement=f"rawmode {_DEPRECATED_RAWMODES[args[0]]}", - ) + if decoder_name == "raw": + rawmode = args[0] + if mode != rawmode and rawmode in _DEPRECATED_RAWMODES: + deprecate( + f"rawmode {rawmode}", + 12, + replacement=f"rawmode {_DEPRECATED_RAWMODES[rawmode]}", + ) try: decoder = DECODERS[decoder_name]