From 7dcf4d8ab319348239d4f8695c6d3366bc257cbf Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 25 Nov 2024 16:43:21 +1100 Subject: [PATCH 1/2] Added logging to fixIFD() --- src/PIL/TiffImagePlugin.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py index 6bf39b75a..a246994ef 100644 --- a/src/PIL/TiffImagePlugin.py +++ b/src/PIL/TiffImagePlugin.py @@ -2202,6 +2202,12 @@ class AppendingTiffWriter(io.BytesIO): if tag in self.Tags: cur_pos = self.f.tell() + tagname = TiffTags.lookup(tag).name + typname = TYPES.get(field_type, "unknown") + msg = f"fixIFD: {tagname} ({tag}) - type: {typname} ({field_type})" + msg += f"- type size: {field_size} - count: {count}" + logger.debug(msg) + if is_local: self._fixOffsets(count, field_size) self.f.seek(cur_pos + 4) From c67ed4678bf16be8630561ce0eb49eb0a2d3be40 Mon Sep 17 00:00:00 2001 From: Andrew Murray <3112309+radarhere@users.noreply.github.com> Date: Thu, 16 Jan 2025 23:48:44 +1100 Subject: [PATCH 2/2] Moved strings inside debug statement Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- src/PIL/TiffImagePlugin.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py index a246994ef..c871342fc 100644 --- a/src/PIL/TiffImagePlugin.py +++ b/src/PIL/TiffImagePlugin.py @@ -2202,11 +2202,15 @@ class AppendingTiffWriter(io.BytesIO): if tag in self.Tags: cur_pos = self.f.tell() - tagname = TiffTags.lookup(tag).name - typname = TYPES.get(field_type, "unknown") - msg = f"fixIFD: {tagname} ({tag}) - type: {typname} ({field_type})" - msg += f"- type size: {field_size} - count: {count}" - logger.debug(msg) + logger.debug( + "fixIFD: %s (%d) - type: %s (%d) - type size: %d - count: %d", + TiffTags.lookup(tag).name, + tag, + TYPES.get(field_type, "unknown"), + field_type, + field_size, + count, + ) if is_local: self._fixOffsets(count, field_size)