1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Docling PPTX Image Extraction Issue - Missing Embedded Images from Placeholders

Discussão em 'Python' iniciado por Stack, Setembro 18, 2025.

  1. Stack

    Stack Membro Participativo

    > '''
    > import logging
    > import time
    > from pathlib import Path
    > from docling_core.types.doc import ImageRefMode, PictureItem, TableItem
    > from docling.datamodel.base_models import InputFormat
    > from docling.datamodel.pipeline_options import PdfPipelineOptions
    > from docling.document_converter import DocumentConverter, PdfFormatOption
    >
    > log = logging.getLogger(__name__)
    > IMAGE_RESOLUTION_SCALE = 2.0
    >
    > def main():
    >
    > logging.basicConfig(level=logging.INFO)
    >
    > input_doc_path = Path(r"SamplePPTX-All.pptx")
    > output_dir = Path(r"scratch")
    >
    > pipeline_options = PdfPipelineOptions()
    > pipeline_options.images_scale = IMAGE_RESOLUTION_SCALE
    > pipeline_options.generate_page_images = False
    > pipeline_options.generate_picture_images = True
    >
    > doc_converter = DocumentConverter(
    > format_options={
    > InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)
    > }
    > )
    >
    > start_time = time.time()
    > conv_res = doc_converter.convert(input_doc_path)
    > output_dir.mkdir(parents=True, exist_ok=True)
    > doc_filename = conv_res.input.file.stem
    >
    > md_filename = output_dir / f"{doc_filename}-with-image-refs.md"
    > conv_res.document.save_as_markdown(md_filename, image_mode=ImageRefMode.REFERENCED)
    >
    > end_time = time.time() - start_time
    > log.info(f"Document converted and figures exported in {end_time:.2f} seconds.")
    >
    > if __name__ == "__main__":
    > main() '''


    1.Specific Detection Issue: My PPTX contains these images:
    Slide 4, Shape 2: Embedded Image in Shape Type PLACEHOLDER (14) - Name: 'Content Placeholder 3' = NOT DETECTED
    Slide 5, Shape 3: PictureItem - Name: 'Picture 4' = DETECTED Slide 5, Shape 4: PictureItem - Name:'Picture 5' = DETECTED
    Slide 8, Shape 2: Embedded Image in Shape Type PLACEHOLDER (14) - Name: 'Picture Placeholder 4' =NOT DETECTED Slide 9, Shape 3: PictureItem - Name: 'Picture 3' = DETECTED


    2.Problem: Docling only detects explicit PictureItems but misses embedded images in placeholders. It lacks configurable options like PDF pipeline (pipeline_options.generate_picture_images = True for PPTX).

    3.Test Results:
    PDF: All images extracted locally + referenced inline in markdown at exact positions
    PPTX: OnlyPictureItems appear - placeholder embedded images missing entirely from markdown

    4.Question: Is there any way to configure Docling to extract ALL embedded images from PPTX (including those in placeholders) and include them inline in markdown with proper positioning, using Docling only?

    5.My Requirement: All images should be extracted locally and referenced inline in markdown () at their exact document positions.
    ​

    Continue reading...

Compartilhe esta Página