Skip to content

Commit c089d1e

Browse files
committed
v0.3.1
1 parent 5f9cb99 commit c089d1e

File tree

2 files changed

+300
-870
lines changed

2 files changed

+300
-870
lines changed

pillow_heif/heif.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ def __init__(self, img_id: int, heif_ctx: Union[LibHeifCtx, HeifCtxAsDict], prim
268268
additional_info.update(heif_ctx.additional_info)
269269
super().__init__(heif_ctx, handle)
270270
self.info = {
271-
"img_id": img_id,
272271
"exif": _exif,
273272
"xmp": _xmp,
274273
"primary": primary,
@@ -280,8 +279,7 @@ def __repr__(self):
280279
_bytes = f"{len(self.data)} bytes" if self._img_data else "no"
281280
return (
282281
f"<{self.__class__.__name__} {self.size[0]}x{self.size[1]} {self.mode} "
283-
f"with id = {self.info['img_id']}, {len(self.thumbnails)} thumbnails. "
284-
f"{_bytes} image data>"
282+
f"with {_bytes} image data and {len(self.thumbnails)} thumbnails>"
285283
)
286284

287285
def load(self):
@@ -602,7 +600,6 @@ def add_from_heif(self, heif_image, load_one=False, ignore_primary=True, **kwarg
602600
heif_images = [heif_image]
603601
for image in heif_images:
604602
additional_info = image.info.copy()
605-
additional_info.pop("img_id", None)
606603
if ignore_primary:
607604
additional_info["primary"] = False
608605
added_image = self._add_frombytes(
@@ -708,10 +705,8 @@ def __delitem__(self, key):
708705
del self.images[key]
709706

710707
def _add_frombytes(self, bit_depth: int, mode: str, size: tuple, data, **kwargs):
711-
__ids = [i.info["img_id"] for i in self.images] + [0]
712-
__new_id = 2 + max(__ids)
713708
__heif_ctx = HeifCtxAsDict(bit_depth, mode, size, data, **kwargs)
714-
added_image = HeifImage(__new_id, __heif_ctx)
709+
added_image = HeifImage(0, __heif_ctx)
715710
self.images.append(added_image)
716711
return added_image
717712

0 commit comments

Comments
 (0)