Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

from . import extra
import importlib.util
import uuid

# Set up g_out_log and g_out_message from environment variables.
#
Expand Down Expand Up @@ -12543,12 +12544,8 @@ def insert_image(
ilst += [i[1] for i in doc.get_page_xobjects(page.number)]
ilst += [i[4] for i in doc.get_page_fonts(page.number)]
n = "fzImg" # 'pymupdf image'
i = 0
_imgname = n + "0" # first name candidate
while _imgname in ilst:
i += 1
_imgname = n + str(i) # try new name

# Use a uuid for uniqueness
_imgname = f"{n}{uuid.uuid4()}"
if overlay:
page.wrap_contents() # ensure a balanced graphics state
digests = doc.InsertedImages
Expand Down
Loading