Skip to content
Discussion options

You must be logged in to vote

Presumably, the easiest way for you to walk is using redaction annotations. You did not mention, whether the to-be-replaced image only lives on a certain page or on several simultaneously. The latter would be a slight complication, so lets assume for the moment, that image lives on one page, which you already know.
The principle is this:

  1. Determine the rectangle occupied by the image on that page
  2. Add a redaction annotation with the image's rectangle
  3. "Apply" (i.e. execute) the redaction, which effectively will remove the old image
  4. Insert your new image in the old image's rectangle

The technical details of above steps would be no longer your business. Here is a snippet:

doc = fitz.open(<your 

Replies: 3 comments 3 replies

Comment options

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

Answer selected by Yiftach-Yaakov
Comment options

You must be logged in to vote
2 replies
@JorjMcKie
Comment options

@Yiftach-Yaakov
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants