docling-project / docling-project/docling

Is there a way to link images to specific chunk after chunking?

Open
#2,318 2 comments 0 reactions 0 assignees View on GitHub
question triage/close-stale
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
2d 21h
Merged PRs (30d)
84

Description

### Question

When i apply chunking using Docling function, in the doc_item of each chunk i don't find any image text, despite the doc.pictures has it.
Is it possible to extract the image for each chunk?

Example code:
```python
from docling.document_converter import DocumentConverter
from docling_core.transforms.chunker.hybrid_chunker import HybridChunker

# set converter
converter = DocumentConverter(
format_options={
InputFormat.DOCX: WordFormatOption(
pipeline_options=PaginatedPipelineOptions(
generate_picture_images=True, images_scale=1.0
)
)
}
)
doc = converter.convert("file.docx")
print(len(doc.pictures) # pictures are found

# Apply chunking
chunker = HybridChunker( max_tokens=None,merge_peers=True)
chunks = chunker.chunk(doc)
tags = [x.label for chunk in chunks for x in chunk.meta.doc_items]
print(set(tags)) # no pictures tag found
```

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.