From b59dea60a6a7c83545f83f9e1f723c1a40f3f7cb Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 8 Feb 2025 21:07:25 +1100 Subject: [PATCH] Simplify Python code by receiving tuple from C --- src/PIL/WebPImagePlugin.py | 3 +-- src/_webp.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/PIL/WebPImagePlugin.py b/src/PIL/WebPImagePlugin.py index 066fe551f..cbbc24af0 100644 --- a/src/PIL/WebPImagePlugin.py +++ b/src/PIL/WebPImagePlugin.py @@ -46,8 +46,7 @@ class WebPImageFile(ImageFile.ImageFile): self._decoder = _webp.WebPAnimDecoder(self.fp.read()) # Get info from decoder - width, height, loop_count, bgcolor, frame_count, mode = self._decoder.get_info() - self._size = width, height + self._size, loop_count, bgcolor, frame_count, mode = self._decoder.get_info() self.info["loop"] = loop_count bg_a, bg_r, bg_g, bg_b = ( (bgcolor >> 24) & 0xFF, diff --git a/src/_webp.c b/src/_webp.c index 26a5ebbc6..48b1c0a74 100644 --- a/src/_webp.c +++ b/src/_webp.c @@ -449,7 +449,7 @@ _anim_decoder_get_info(PyObject *self) { WebPAnimInfo *info = &(decp->info); return Py_BuildValue( - "IIIIIs", + "(II)IIIs", info->canvas_width, info->canvas_height, info->loop_count,