mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-30 22:14:37 +00:00
Inferring image DPI from pptx file
Signed-off-by: Maksym Lysak <mly@zurich.ibm.com>
This commit is contained in:
parent
22400089c0
commit
b132c68a32
@ -273,6 +273,8 @@ class MsPowerpointDocumentBackend(DeclarativeDocumentBackend, PaginatedDocumentB
|
||||
# Get the image bytes
|
||||
image = shape.image
|
||||
image_bytes = image.blob
|
||||
im_dpi, _ = image.dpi
|
||||
|
||||
# Open it with PIL
|
||||
pil_image = Image.open(BytesIO(image_bytes))
|
||||
|
||||
@ -280,7 +282,7 @@ class MsPowerpointDocumentBackend(DeclarativeDocumentBackend, PaginatedDocumentB
|
||||
prov = self.generate_prov(shape, slide_ind, "")
|
||||
doc.add_picture(
|
||||
parent=parent_slide,
|
||||
image=ImageRef.from_pil(image=pil_image, dpi=72),
|
||||
image=ImageRef.from_pil(image=pil_image, dpi=im_dpi),
|
||||
caption=None,
|
||||
prov=prov,
|
||||
)
|
||||
|
@ -127,7 +127,7 @@
|
||||
"footnotes": [],
|
||||
"image": {
|
||||
"mimetype": "image/png",
|
||||
"dpi": 72,
|
||||
"dpi": 300,
|
||||
"size": {
|
||||
"width": 268.0,
|
||||
"height": 268.0
|
||||
|
Loading…
Reference in New Issue
Block a user