mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-10 08:12:33 +03:00
Removed support for LibTIFF < 4
This commit is contained in:
parent
a7e00fba8b
commit
9c9449af34
|
@ -256,19 +256,7 @@ class TestFileLibTiff(LibTiffTestCase):
|
|||
|
||||
im.save(out, tiffinfo=new_ifd)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"libtiff",
|
||||
(
|
||||
pytest.param(
|
||||
True,
|
||||
marks=pytest.mark.skipif(
|
||||
not getattr(Image.core, "libtiff_support_custom_tags", False),
|
||||
reason="Custom tags not supported by older libtiff",
|
||||
),
|
||||
),
|
||||
False,
|
||||
),
|
||||
)
|
||||
@pytest.mark.parametrize("libtiff", (True, False))
|
||||
def test_custom_metadata(
|
||||
self, monkeypatch: pytest.MonkeyPatch, tmp_path: Path, libtiff: bool
|
||||
) -> None:
|
||||
|
@ -724,8 +712,7 @@ class TestFileLibTiff(LibTiffTestCase):
|
|||
|
||||
with Image.open(out) as reloaded:
|
||||
assert isinstance(reloaded, TiffImagePlugin.TiffImageFile)
|
||||
if Image.core.libtiff_support_custom_tags:
|
||||
assert reloaded.tag_v2[34665] == 125456
|
||||
assert reloaded.tag_v2[34665] == 125456
|
||||
|
||||
def test_crashing_metadata(
|
||||
self, monkeypatch: pytest.MonkeyPatch, tmp_path: Path
|
||||
|
@ -777,19 +764,7 @@ class TestFileLibTiff(LibTiffTestCase):
|
|||
assert icc_libtiff is not None
|
||||
assert icc == icc_libtiff
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"libtiff",
|
||||
(
|
||||
pytest.param(
|
||||
True,
|
||||
marks=pytest.mark.skipif(
|
||||
not getattr(Image.core, "libtiff_support_custom_tags", False),
|
||||
reason="Custom tags not supported by older libtiff",
|
||||
),
|
||||
),
|
||||
False,
|
||||
),
|
||||
)
|
||||
@pytest.mark.parametrize("libtiff", (True, False))
|
||||
def test_write_icc(
|
||||
self, monkeypatch: pytest.MonkeyPatch, tmp_path: Path, libtiff: bool
|
||||
) -> None:
|
||||
|
|
|
@ -77,14 +77,6 @@ The use in :py:mod:`.ImageCms` of input modes and output modes that are not Pill
|
|||
image modes has been deprecated. Defaulting to "L" or "1" if the mode cannot be mapped
|
||||
is also deprecated.
|
||||
|
||||
Support for LibTIFF earlier than 4
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. deprecated:: 10.4.0
|
||||
|
||||
Support for LibTIFF earlier than version 4 has been deprecated.
|
||||
Upgrade to a newer version of LibTIFF instead.
|
||||
|
||||
ImageDraw.getdraw hints parameter
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -194,6 +186,15 @@ BGR;15, BGR 16 and BGR;24
|
|||
|
||||
The experimental BGR;15, BGR;16 and BGR;24 modes have been removed.
|
||||
|
||||
Support for LibTIFF earlier than 4
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. deprecated:: 10.4.0
|
||||
.. versionremoved:: 12.0.0
|
||||
|
||||
Support for LibTIFF earlier than version 4 has been removed.
|
||||
Upgrade to a newer version of LibTIFF instead.
|
||||
|
||||
Image isImageType()
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@ from . import ExifTags, Image, ImageFile, ImageOps, ImagePalette, TiffTags
|
|||
from ._binary import i16be as i16
|
||||
from ._binary import i32be as i32
|
||||
from ._binary import o8
|
||||
from ._deprecate import deprecate
|
||||
from ._typing import StrOrBytesPath
|
||||
from ._util import DeferredError, is_path
|
||||
from .TiffTags import TYPES
|
||||
|
@ -284,9 +283,6 @@ PREFIXES = [
|
|||
b"II\x2b\x00", # BigTIFF with little-endian byte order
|
||||
]
|
||||
|
||||
if not getattr(Image.core, "libtiff_support_custom_tags", True):
|
||||
deprecate("Support for LibTIFF earlier than version 4", 12)
|
||||
|
||||
|
||||
def _accept(prefix: bytes) -> bool:
|
||||
return prefix.startswith(tuple(PREFIXES))
|
||||
|
@ -1934,9 +1930,6 @@ def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None:
|
|||
# Custom items are supported for int, float, unicode, string and byte
|
||||
# values. Other types and tuples require a tagtype.
|
||||
if tag not in TiffTags.LIBTIFF_CORE:
|
||||
if not getattr(Image.core, "libtiff_support_custom_tags", False):
|
||||
continue
|
||||
|
||||
if tag in TiffTags.TAGS_V2_GROUPS:
|
||||
types[tag] = TiffTags.LONG8
|
||||
elif tag in ifd.tagtype:
|
||||
|
|
|
@ -4352,16 +4352,6 @@ setup_module(PyObject *m) {
|
|||
PyObject *v = PyUnicode_FromString(ImagingTiffVersion());
|
||||
PyDict_SetItemString(d, "libtiff_version", v ? v : Py_None);
|
||||
Py_XDECREF(v);
|
||||
|
||||
// Test for libtiff 4.0 or later, excluding libtiff 3.9.6 and 3.9.7
|
||||
PyObject *support_custom_tags;
|
||||
#if TIFFLIB_VERSION >= 20111221 && TIFFLIB_VERSION != 20120218 && \
|
||||
TIFFLIB_VERSION != 20120922
|
||||
support_custom_tags = Py_True;
|
||||
#else
|
||||
support_custom_tags = Py_False;
|
||||
#endif
|
||||
PyDict_SetItemString(d, "libtiff_support_custom_tags", support_custom_tags);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -884,7 +884,6 @@ ImagingLibTiffMergeFieldInfo(
|
|||
// Refer to libtiff docs (http://www.simplesystems.org/libtiff/addingtags.html)
|
||||
TIFFSTATE *clientstate = (TIFFSTATE *)state->context;
|
||||
uint32_t n;
|
||||
int status = 0;
|
||||
|
||||
// custom fields added with ImagingLibTiffMergeFieldInfo are only used for
|
||||
// decoding, ignore readcount;
|
||||
|
@ -907,14 +906,7 @@ ImagingLibTiffMergeFieldInfo(
|
|||
|
||||
n = sizeof(info) / sizeof(info[0]);
|
||||
|
||||
// Test for libtiff 4.0 or later, excluding libtiff 3.9.6 and 3.9.7
|
||||
#if TIFFLIB_VERSION >= 20111221 && TIFFLIB_VERSION != 20120218 && \
|
||||
TIFFLIB_VERSION != 20120922
|
||||
status = TIFFMergeFieldInfo(clientstate->tiff, info, n);
|
||||
#else
|
||||
TIFFMergeFieldInfo(clientstate->tiff, info, n);
|
||||
#endif
|
||||
return status;
|
||||
return TIFFMergeFieldInfo(clientstate->tiff, info, n);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Reference in New Issue
Block a user