Skip to content

Commit 9fbc255

Browse files
committed
Removed non-image modes in ImageCms
1 parent b4bc43f commit 9fbc255

File tree

3 files changed

+12
-51
lines changed

3 files changed

+12
-51
lines changed

Tests/test_imagecms.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -673,12 +673,6 @@ def test_auxiliary_channels_isolated() -> None:
673673
assert_image_equal(test_image.convert(dst_format[2]), reference_image)
674674

675675

676-
def test_long_modes() -> None:
677-
p = ImageCms.getOpenProfile("Tests/icc/sGrey-v2-nano.icc")
678-
with pytest.warns(DeprecationWarning, match="ABCDEFGHI"):
679-
ImageCms.buildTransform(p, p, "ABCDEFGHI", "ABCDEFGHI")
680-
681-
682676
@pytest.mark.parametrize("mode", ("RGB", "RGBA", "RGBX"))
683677
def test_rgb_lab(mode: str) -> None:
684678
im = Image.new(mode, (1, 1))
@@ -696,11 +690,3 @@ def test_cmyk_lab() -> None:
696690
im = Image.new("CMYK", (1, 1))
697691
converted_im = im.convert("LAB")
698692
assert converted_im.getpixel((0, 0)) == (255, 128, 128)
699-
700-
701-
def test_deprecation() -> None:
702-
profile = ImageCmsProfile(ImageCms.createProfile("sRGB"))
703-
with pytest.warns(DeprecationWarning, match="RGBA;16B"):
704-
ImageCms.ImageCmsTransform(profile, profile, "RGBA;16B", "RGB")
705-
with pytest.warns(DeprecationWarning, match="RGBA;16B"):
706-
ImageCms.ImageCmsTransform(profile, profile, "RGB", "RGBA;16B")

docs/deprecations.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ Deprecated features
1212
Below are features which are considered deprecated. Where appropriate,
1313
a :py:exc:`DeprecationWarning` is issued.
1414

15-
Non-image modes in ImageCms
16-
^^^^^^^^^^^^^^^^^^^^^^^^^^^
17-
18-
.. deprecated:: 10.4.0
19-
20-
The use in :py:mod:`.ImageCms` of input modes and output modes that are not Pillow
21-
image modes has been deprecated. Defaulting to "L" or "1" if the mode cannot be mapped
22-
is also deprecated.
23-
2415
ImageDraw.getdraw hints parameter
2516
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2617

@@ -171,6 +162,16 @@ BGR;15, BGR 16 and BGR;24
171162

172163
The experimental BGR;15, BGR;16 and BGR;24 modes have been removed.
173164

165+
Non-image modes in ImageCms
166+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
167+
168+
.. deprecated:: 10.4.0
169+
.. versionremoved:: 12.0.0
170+
171+
The use in :py:mod:`.ImageCms` of input modes and output modes that are not Pillow
172+
image modes has been removed. Defaulting to "L" or "1" if the mode cannot be mapped has
173+
also been removed.
174+
174175
Support for LibTIFF earlier than 4
175176
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
176177

src/PIL/ImageCms.py

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@
2323
import sys
2424
from enum import IntEnum, IntFlag
2525
from functools import reduce
26-
from typing import Any, Literal, SupportsFloat, SupportsInt, Union
26+
from typing import Literal, SupportsFloat, SupportsInt, Union
2727

28-
from . import Image, __version__
29-
from ._deprecate import deprecate
28+
from . import Image
3029
from ._typing import SupportsRead
3130

3231
try:
@@ -287,31 +286,6 @@ def __init__(
287286
proof_intent: Intent = Intent.ABSOLUTE_COLORIMETRIC,
288287
flags: Flags = Flags.NONE,
289288
):
290-
supported_modes = (
291-
"RGB",
292-
"RGBA",
293-
"RGBX",
294-
"CMYK",
295-
"I;16",
296-
"I;16L",
297-
"I;16B",
298-
"YCbCr",
299-
"LAB",
300-
"L",
301-
"1",
302-
)
303-
for mode in (input_mode, output_mode):
304-
if mode not in supported_modes:
305-
deprecate(
306-
mode,
307-
12,
308-
{
309-
"L;16": "I;16 or I;16L",
310-
"L:16B": "I;16B",
311-
"YCCA": "YCbCr",
312-
"YCC": "YCbCr",
313-
}.get(mode),
314-
)
315289
if proof is None:
316290
self.transform = core.buildTransform(
317291
input.profile, output.profile, input_mode, output_mode, intent, flags

0 commit comments

Comments
 (0)