docling-project / docling-project/docling

The image is not returned in VlmPipeline when generate_page_images=True

Open
#1,195 1 comment 0 reactions 1 assignee Claimed by @maxmnemonic View on GitHub
bug triage/close-stale vlm-pipeline
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
2d 21h
Merged PRs (30d)
84

Description

I think the problem is in the VLMPipeline line 399:

```python
image = page.image

page_no = pg_idx + 1
bounding_boxes = []

if page.size:
pg_width = page.size.width
pg_height = page.size.height
size = Size(width=pg_width, height=pg_height)
parent_page = doc.add_page(page_no=page_no, size=size)

```

Should be something like:
```python
image = page.image

page_no = pg_idx + 1
bounding_boxes = []

if page.size:
pg_width = page.size.width
pg_height = page.size.height
size = Size(width=pg_width, height=pg_height)
if self.keep_images:
image_ref = ImageRef.from_pil(image, dpi=not_sure_about_this_one)
else:
image_ref=None
parent_page = doc.add_page(page_no=page_no, size=size, image=image_ref)

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.