Skip to content

QUESTION: insert_image cover the origin text #3717

Answered by JorjMcKie
Syntamin asked this question in Q&A
Discussion options

You must be logged in to vote

Simply add parameter overlay=False:

for rect_index, rect in enumerate(image_rect, start=0):
    print(rect_index, rect)

    image_xref = page.insert_image(
        image_rect[rect_index],
        stream=compressed_base_image_bytes,
        mask=compressed_mask_image_bytes,
        xref=image_xref,
        overlay=False,  # <=== puts in background
    )
    # you do not need this:
    # page.apply_redactions(pymupdf.PDF_REDACT_IMAGE_NONE)
``

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Syntamin
Comment options

Answer selected by Syntamin
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
Converted from issue

This discussion was converted from issue #3716 on July 23, 2024 07:10.