2018-07-04 16:28:02 +03:00
|
|
|
"""Pillow (Fork of the Python Imaging Library)
|
2018-07-01 10:45:08 +03:00
|
|
|
|
|
|
|
Pillow is the friendly PIL fork by Alex Clark and Contributors.
|
|
|
|
https://github.com/python-pillow/Pillow/
|
|
|
|
|
|
|
|
Pillow is forked from PIL 1.1.7.
|
|
|
|
|
|
|
|
PIL is the Python Imaging Library by Fredrik Lundh and Contributors.
|
|
|
|
Copyright (c) 1999 by Secret Labs AB.
|
|
|
|
|
|
|
|
Use PIL.__version__ for this Pillow version.
|
|
|
|
|
|
|
|
;-)
|
|
|
|
"""
|
2013-04-15 21:57:37 +04:00
|
|
|
|
2020-03-31 09:41:47 +03:00
|
|
|
import sys
|
2020-03-30 13:53:02 +03:00
|
|
|
import warnings
|
|
|
|
|
2018-04-09 16:09:36 +03:00
|
|
|
from . import _version
|
2017-04-19 17:39:39 +03:00
|
|
|
|
2019-01-29 20:10:52 +03:00
|
|
|
# VERSION was removed in Pillow 6.0.0.
|
2020-03-30 13:53:02 +03:00
|
|
|
__version__ = _version.__version__
|
|
|
|
|
|
|
|
|
2020-03-31 09:41:47 +03:00
|
|
|
# PILLOW_VERSION is deprecated and will be removed in a future release.
|
|
|
|
# Use __version__ instead.
|
|
|
|
def _raise_version_warning():
|
|
|
|
warnings.warn(
|
2020-12-10 15:32:43 +03:00
|
|
|
"PILLOW_VERSION is deprecated and will be removed in Pillow 9 (2022-01-02). "
|
2020-03-31 09:41:47 +03:00
|
|
|
"Use __version__ instead.",
|
|
|
|
DeprecationWarning,
|
|
|
|
stacklevel=3,
|
|
|
|
)
|
2020-03-30 13:53:02 +03:00
|
|
|
|
|
|
|
|
2020-03-31 09:41:47 +03:00
|
|
|
if sys.version_info >= (3, 7):
|
2020-03-30 13:53:02 +03:00
|
|
|
|
2020-03-31 09:41:47 +03:00
|
|
|
def __getattr__(name):
|
|
|
|
if name == "PILLOW_VERSION":
|
|
|
|
_raise_version_warning()
|
|
|
|
return __version__
|
2020-07-16 12:43:29 +03:00
|
|
|
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
|
2020-03-30 13:53:02 +03:00
|
|
|
|
2020-03-31 09:41:47 +03:00
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
class _Deprecated_Version(str):
|
|
|
|
def __str__(self):
|
|
|
|
_raise_version_warning()
|
|
|
|
return super().__str__()
|
|
|
|
|
|
|
|
def __getitem__(self, key):
|
|
|
|
_raise_version_warning()
|
|
|
|
return super().__getitem__(key)
|
|
|
|
|
|
|
|
def __eq__(self, other):
|
|
|
|
_raise_version_warning()
|
|
|
|
return super().__eq__(other)
|
|
|
|
|
|
|
|
def __ne__(self, other):
|
|
|
|
_raise_version_warning()
|
|
|
|
return super().__ne__(other)
|
|
|
|
|
|
|
|
def __gt__(self, other):
|
|
|
|
_raise_version_warning()
|
|
|
|
return super().__gt__(other)
|
|
|
|
|
|
|
|
def __lt__(self, other):
|
|
|
|
_raise_version_warning()
|
|
|
|
return super().__lt__(other)
|
|
|
|
|
|
|
|
def __ge__(self, other):
|
|
|
|
_raise_version_warning()
|
|
|
|
return super().__gt__(other)
|
|
|
|
|
|
|
|
def __le__(self, other):
|
|
|
|
_raise_version_warning()
|
|
|
|
return super().__lt__(other)
|
|
|
|
|
|
|
|
PILLOW_VERSION = _Deprecated_Version(__version__)
|
2013-04-15 21:57:37 +04:00
|
|
|
|
2018-04-09 16:09:36 +03:00
|
|
|
del _version
|
2016-07-15 11:00:55 +03:00
|
|
|
|
2018-07-01 10:45:08 +03:00
|
|
|
|
2019-03-21 16:28:20 +03:00
|
|
|
_plugins = [
|
|
|
|
"BlpImagePlugin",
|
|
|
|
"BmpImagePlugin",
|
|
|
|
"BufrStubImagePlugin",
|
|
|
|
"CurImagePlugin",
|
|
|
|
"DcxImagePlugin",
|
|
|
|
"DdsImagePlugin",
|
|
|
|
"EpsImagePlugin",
|
|
|
|
"FitsStubImagePlugin",
|
|
|
|
"FliImagePlugin",
|
|
|
|
"FpxImagePlugin",
|
|
|
|
"FtexImagePlugin",
|
|
|
|
"GbrImagePlugin",
|
|
|
|
"GifImagePlugin",
|
|
|
|
"GribStubImagePlugin",
|
|
|
|
"Hdf5StubImagePlugin",
|
|
|
|
"IcnsImagePlugin",
|
|
|
|
"IcoImagePlugin",
|
|
|
|
"ImImagePlugin",
|
|
|
|
"ImtImagePlugin",
|
|
|
|
"IptcImagePlugin",
|
|
|
|
"JpegImagePlugin",
|
|
|
|
"Jpeg2KImagePlugin",
|
|
|
|
"McIdasImagePlugin",
|
|
|
|
"MicImagePlugin",
|
|
|
|
"MpegImagePlugin",
|
|
|
|
"MpoImagePlugin",
|
|
|
|
"MspImagePlugin",
|
|
|
|
"PalmImagePlugin",
|
|
|
|
"PcdImagePlugin",
|
|
|
|
"PcxImagePlugin",
|
|
|
|
"PdfImagePlugin",
|
|
|
|
"PixarImagePlugin",
|
|
|
|
"PngImagePlugin",
|
|
|
|
"PpmImagePlugin",
|
|
|
|
"PsdImagePlugin",
|
|
|
|
"SgiImagePlugin",
|
|
|
|
"SpiderImagePlugin",
|
|
|
|
"SunImagePlugin",
|
|
|
|
"TgaImagePlugin",
|
|
|
|
"TiffImagePlugin",
|
|
|
|
"WebPImagePlugin",
|
|
|
|
"WmfImagePlugin",
|
|
|
|
"XbmImagePlugin",
|
|
|
|
"XpmImagePlugin",
|
|
|
|
"XVThumbImagePlugin",
|
|
|
|
]
|
2019-11-19 13:20:02 +03:00
|
|
|
|
|
|
|
|
2020-04-07 09:58:21 +03:00
|
|
|
class UnidentifiedImageError(OSError):
|
2020-06-14 17:40:28 +03:00
|
|
|
"""
|
|
|
|
Raised in :py:meth:`PIL.Image.open` if an image cannot be opened and identified.
|
|
|
|
"""
|
|
|
|
|
2019-11-19 13:20:02 +03:00
|
|
|
pass
|