mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-11 08:42:35 +03:00
Removed non-image modes in ImageCms
This commit is contained in:
parent
b4bc43fed2
commit
9fbc255ce5
|
@ -673,12 +673,6 @@ def test_auxiliary_channels_isolated() -> None:
|
||||||
assert_image_equal(test_image.convert(dst_format[2]), reference_image)
|
assert_image_equal(test_image.convert(dst_format[2]), reference_image)
|
||||||
|
|
||||||
|
|
||||||
def test_long_modes() -> None:
|
|
||||||
p = ImageCms.getOpenProfile("Tests/icc/sGrey-v2-nano.icc")
|
|
||||||
with pytest.warns(DeprecationWarning, match="ABCDEFGHI"):
|
|
||||||
ImageCms.buildTransform(p, p, "ABCDEFGHI", "ABCDEFGHI")
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("mode", ("RGB", "RGBA", "RGBX"))
|
@pytest.mark.parametrize("mode", ("RGB", "RGBA", "RGBX"))
|
||||||
def test_rgb_lab(mode: str) -> None:
|
def test_rgb_lab(mode: str) -> None:
|
||||||
im = Image.new(mode, (1, 1))
|
im = Image.new(mode, (1, 1))
|
||||||
|
@ -696,11 +690,3 @@ def test_cmyk_lab() -> None:
|
||||||
im = Image.new("CMYK", (1, 1))
|
im = Image.new("CMYK", (1, 1))
|
||||||
converted_im = im.convert("LAB")
|
converted_im = im.convert("LAB")
|
||||||
assert converted_im.getpixel((0, 0)) == (255, 128, 128)
|
assert converted_im.getpixel((0, 0)) == (255, 128, 128)
|
||||||
|
|
||||||
|
|
||||||
def test_deprecation() -> None:
|
|
||||||
profile = ImageCmsProfile(ImageCms.createProfile("sRGB"))
|
|
||||||
with pytest.warns(DeprecationWarning, match="RGBA;16B"):
|
|
||||||
ImageCms.ImageCmsTransform(profile, profile, "RGBA;16B", "RGB")
|
|
||||||
with pytest.warns(DeprecationWarning, match="RGBA;16B"):
|
|
||||||
ImageCms.ImageCmsTransform(profile, profile, "RGB", "RGBA;16B")
|
|
||||||
|
|
|
@ -12,15 +12,6 @@ Deprecated features
|
||||||
Below are features which are considered deprecated. Where appropriate,
|
Below are features which are considered deprecated. Where appropriate,
|
||||||
a :py:exc:`DeprecationWarning` is issued.
|
a :py:exc:`DeprecationWarning` is issued.
|
||||||
|
|
||||||
Non-image modes in ImageCms
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
.. deprecated:: 10.4.0
|
|
||||||
|
|
||||||
The use in :py:mod:`.ImageCms` of input modes and output modes that are not Pillow
|
|
||||||
image modes has been deprecated. Defaulting to "L" or "1" if the mode cannot be mapped
|
|
||||||
is also deprecated.
|
|
||||||
|
|
||||||
ImageDraw.getdraw hints parameter
|
ImageDraw.getdraw hints parameter
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
@ -171,6 +162,16 @@ BGR;15, BGR 16 and BGR;24
|
||||||
|
|
||||||
The experimental BGR;15, BGR;16 and BGR;24 modes have been removed.
|
The experimental BGR;15, BGR;16 and BGR;24 modes have been removed.
|
||||||
|
|
||||||
|
Non-image modes in ImageCms
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. deprecated:: 10.4.0
|
||||||
|
.. versionremoved:: 12.0.0
|
||||||
|
|
||||||
|
The use in :py:mod:`.ImageCms` of input modes and output modes that are not Pillow
|
||||||
|
image modes has been removed. Defaulting to "L" or "1" if the mode cannot be mapped has
|
||||||
|
also been removed.
|
||||||
|
|
||||||
Support for LibTIFF earlier than 4
|
Support for LibTIFF earlier than 4
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,9 @@ import operator
|
||||||
import sys
|
import sys
|
||||||
from enum import IntEnum, IntFlag
|
from enum import IntEnum, IntFlag
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
from typing import Any, Literal, SupportsFloat, SupportsInt, Union
|
from typing import Literal, SupportsFloat, SupportsInt, Union
|
||||||
|
|
||||||
from . import Image, __version__
|
from . import Image
|
||||||
from ._deprecate import deprecate
|
|
||||||
from ._typing import SupportsRead
|
from ._typing import SupportsRead
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -287,31 +286,6 @@ class ImageCmsTransform(Image.ImagePointHandler):
|
||||||
proof_intent: Intent = Intent.ABSOLUTE_COLORIMETRIC,
|
proof_intent: Intent = Intent.ABSOLUTE_COLORIMETRIC,
|
||||||
flags: Flags = Flags.NONE,
|
flags: Flags = Flags.NONE,
|
||||||
):
|
):
|
||||||
supported_modes = (
|
|
||||||
"RGB",
|
|
||||||
"RGBA",
|
|
||||||
"RGBX",
|
|
||||||
"CMYK",
|
|
||||||
"I;16",
|
|
||||||
"I;16L",
|
|
||||||
"I;16B",
|
|
||||||
"YCbCr",
|
|
||||||
"LAB",
|
|
||||||
"L",
|
|
||||||
"1",
|
|
||||||
)
|
|
||||||
for mode in (input_mode, output_mode):
|
|
||||||
if mode not in supported_modes:
|
|
||||||
deprecate(
|
|
||||||
mode,
|
|
||||||
12,
|
|
||||||
{
|
|
||||||
"L;16": "I;16 or I;16L",
|
|
||||||
"L:16B": "I;16B",
|
|
||||||
"YCCA": "YCbCr",
|
|
||||||
"YCC": "YCbCr",
|
|
||||||
}.get(mode),
|
|
||||||
)
|
|
||||||
if proof is None:
|
if proof is None:
|
||||||
self.transform = core.buildTransform(
|
self.transform = core.buildTransform(
|
||||||
input.profile, output.profile, input_mode, output_mode, intent, flags
|
input.profile, output.profile, input_mode, output_mode, intent, flags
|
||||||
|
|
Loading…
Reference in New Issue
Block a user