mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-06 05:55:42 +00:00
nem sei pq tantos arquivos
This commit is contained in:
@@ -692,13 +692,10 @@ class Image:
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return "<%s.%s image mode=%s size=%dx%d at 0x%X>" % (
|
||||
self.__class__.__module__,
|
||||
self.__class__.__name__,
|
||||
self.mode,
|
||||
self.size[0],
|
||||
self.size[1],
|
||||
id(self),
|
||||
return (
|
||||
f"<{self.__class__.__module__}.{self.__class__.__name__} "
|
||||
f"image mode={self.mode} size={self.size[0]}x{self.size[1]} "
|
||||
f"at 0x{id(self):X}>"
|
||||
)
|
||||
|
||||
def _repr_pretty_(self, p: PrettyPrinter, cycle: bool) -> None:
|
||||
@@ -707,14 +704,8 @@ class Image:
|
||||
# Same as __repr__ but without unpredictable id(self),
|
||||
# to keep Jupyter notebook `text/plain` output stable.
|
||||
p.text(
|
||||
"<%s.%s image mode=%s size=%dx%d>"
|
||||
% (
|
||||
self.__class__.__module__,
|
||||
self.__class__.__name__,
|
||||
self.mode,
|
||||
self.size[0],
|
||||
self.size[1],
|
||||
)
|
||||
f"<{self.__class__.__module__}.{self.__class__.__name__} "
|
||||
f"image mode={self.mode} size={self.size[0]}x{self.size[1]}>"
|
||||
)
|
||||
|
||||
def _repr_image(self, image_format: str, **kwargs: Any) -> bytes | None:
|
||||
@@ -763,7 +754,7 @@ class Image:
|
||||
|
||||
def __setstate__(self, state: list[Any]) -> None:
|
||||
Image.__init__(self)
|
||||
info, mode, size, palette, data = state
|
||||
info, mode, size, palette, data = state[:5]
|
||||
self.info = info
|
||||
self._mode = mode
|
||||
self._size = size
|
||||
@@ -1574,7 +1565,7 @@ class Image:
|
||||
for subifd_offset in subifd_offsets:
|
||||
ifds.append((exif._get_ifd_dict(subifd_offset), subifd_offset))
|
||||
ifd1 = exif.get_ifd(ExifTags.IFD.IFD1)
|
||||
if ifd1 and ifd1.get(513):
|
||||
if ifd1 and ifd1.get(ExifTags.Base.JpegIFOffset):
|
||||
assert exif._info is not None
|
||||
ifds.append((ifd1, exif._info.next))
|
||||
|
||||
@@ -1586,11 +1577,11 @@ class Image:
|
||||
|
||||
fp = self.fp
|
||||
if ifd is not None:
|
||||
thumbnail_offset = ifd.get(513)
|
||||
thumbnail_offset = ifd.get(ExifTags.Base.JpegIFOffset)
|
||||
if thumbnail_offset is not None:
|
||||
thumbnail_offset += getattr(self, "_exif_offset", 0)
|
||||
self.fp.seek(thumbnail_offset)
|
||||
data = self.fp.read(ifd.get(514))
|
||||
data = self.fp.read(ifd.get(ExifTags.Base.JpegIFByteCount))
|
||||
fp = io.BytesIO(data)
|
||||
|
||||
with open(fp) as im:
|
||||
@@ -2550,7 +2541,7 @@ class Image:
|
||||
filename: str | bytes = ""
|
||||
open_fp = False
|
||||
if is_path(fp):
|
||||
filename = os.path.realpath(os.fspath(fp))
|
||||
filename = os.fspath(fp)
|
||||
open_fp = True
|
||||
elif fp == sys.stdout:
|
||||
try:
|
||||
@@ -2559,13 +2550,13 @@ class Image:
|
||||
pass
|
||||
if not filename and hasattr(fp, "name") and is_path(fp.name):
|
||||
# only set the name for metadata purposes
|
||||
filename = os.path.realpath(os.fspath(fp.name))
|
||||
filename = os.fspath(fp.name)
|
||||
|
||||
# may mutate self!
|
||||
self._ensure_mutable()
|
||||
|
||||
save_all = params.pop("save_all", False)
|
||||
self.encoderinfo = params
|
||||
self.encoderinfo = {**getattr(self, "encoderinfo", {}), **params}
|
||||
self.encoderconfig: tuple[Any, ...] = ()
|
||||
|
||||
preinit()
|
||||
@@ -2612,6 +2603,11 @@ class Image:
|
||||
except PermissionError:
|
||||
pass
|
||||
raise
|
||||
finally:
|
||||
try:
|
||||
del self.encoderinfo
|
||||
except AttributeError:
|
||||
pass
|
||||
if open_fp:
|
||||
fp.close()
|
||||
|
||||
@@ -3463,7 +3459,7 @@ def open(
|
||||
exclusive_fp = False
|
||||
filename: str | bytes = ""
|
||||
if is_path(fp):
|
||||
filename = os.path.realpath(os.fspath(fp))
|
||||
filename = os.fspath(fp)
|
||||
|
||||
if filename:
|
||||
fp = builtins.open(filename, "rb")
|
||||
@@ -3893,7 +3889,7 @@ class Exif(_ExifBase):
|
||||
gps_ifd = exif.get_ifd(ExifTags.IFD.GPSInfo)
|
||||
print(gps_ifd)
|
||||
|
||||
Other IFDs include ``ExifTags.IFD.Exif``, ``ExifTags.IFD.Makernote``,
|
||||
Other IFDs include ``ExifTags.IFD.Exif``, ``ExifTags.IFD.MakerNote``,
|
||||
``ExifTags.IFD.Interop`` and ``ExifTags.IFD.IFD1``.
|
||||
|
||||
:py:mod:`~PIL.ExifTags` also has enum classes to provide names for data::
|
||||
@@ -4027,6 +4023,9 @@ class Exif(_ExifBase):
|
||||
|
||||
head = self._get_head()
|
||||
ifd = TiffImagePlugin.ImageFileDirectory_v2(ifh=head)
|
||||
for tag, ifd_dict in self._ifds.items():
|
||||
if tag not in self:
|
||||
ifd[tag] = ifd_dict
|
||||
for tag, value in self.items():
|
||||
if tag in [
|
||||
ExifTags.IFD.Exif,
|
||||
@@ -4056,11 +4055,11 @@ class Exif(_ExifBase):
|
||||
ifd = self._get_ifd_dict(offset, tag)
|
||||
if ifd is not None:
|
||||
self._ifds[tag] = ifd
|
||||
elif tag in [ExifTags.IFD.Interop, ExifTags.IFD.Makernote]:
|
||||
elif tag in [ExifTags.IFD.Interop, ExifTags.IFD.MakerNote]:
|
||||
if ExifTags.IFD.Exif not in self._ifds:
|
||||
self.get_ifd(ExifTags.IFD.Exif)
|
||||
tag_data = self._ifds[ExifTags.IFD.Exif][tag]
|
||||
if tag == ExifTags.IFD.Makernote:
|
||||
if tag == ExifTags.IFD.MakerNote:
|
||||
from .TiffImagePlugin import ImageFileDirectory_v2
|
||||
|
||||
if tag_data[:8] == b"FUJIFILM":
|
||||
@@ -4147,7 +4146,7 @@ class Exif(_ExifBase):
|
||||
ifd = {
|
||||
k: v
|
||||
for (k, v) in ifd.items()
|
||||
if k not in (ExifTags.IFD.Interop, ExifTags.IFD.Makernote)
|
||||
if k not in (ExifTags.IFD.Interop, ExifTags.IFD.MakerNote)
|
||||
}
|
||||
return ifd
|
||||
|
||||
|
||||
Reference in New Issue
Block a user