Skip to content

generate_page_image from PPTX? #545

Answered by dolfim-ibm
tejaswib428 asked this question in Q&A
Discussion options

You must be logged in to vote

This code is saving the whole page images, which indeed are not supported in PPTX.

But you should still be able to save the images in the document with something like the following:

    for element, _level in conv_res.document.iterate_items():
        if isinstance(element, TableItem):
            table_counter += 1
            element_image_filename = (
                output_dir / f"{doc_filename}-table-{table_counter}.png"
            )
            with element_image_filename.open("wb") as fp:
                element.get_image(conv_res.document).save(fp, "PNG")

        if isinstance(element, PictureItem):
            picture_counter += 1
            element_image_filename = (
        …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@tejaswib428
Comment options

@dolfim-ibm
Comment options

Answer selected by dolfim-ibm
@tejaswib428
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants