From 1b7a3756e0d77ae32291382bf8dfd5f9fb5f09fd Mon Sep 17 00:00:00 2001 From: Manuel030 Date: Tue, 26 Nov 2024 15:13:10 +0100 Subject: [PATCH] fix image index in word backend Signed-off-by: Manuel030 --- docling/backend/msword_backend.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docling/backend/msword_backend.py b/docling/backend/msword_backend.py index 089e94c2..24015f4a 100644 --- a/docling/backend/msword_backend.py +++ b/docling/backend/msword_backend.py @@ -503,8 +503,9 @@ class MsWordDocumentBackend(DeclarativeDocumentBackend): image_bytes = BytesIO(image_data) # Open the BytesIO object with PIL to create an Image pil_image = Image.open(image_bytes) + level = self.get_level() doc.add_picture( - parent=self.parents[self.level], + parent=self.parents[level - 1], image=ImageRef.from_pil(image=pil_image, dpi=72), caption=None, )