We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 62a6e4c commit 77c6e8cCopy full SHA for 77c6e8c
1 file changed
src/__init__.py
@@ -29,6 +29,7 @@
29
30
from . import extra
31
import importlib.util
32
+import uuid
33
34
# Set up g_out_log and g_out_message from environment variables.
35
#
@@ -12543,12 +12544,8 @@ def insert_image(
12543
12544
ilst += [i[1] for i in doc.get_page_xobjects(page.number)]
12545
ilst += [i[4] for i in doc.get_page_fonts(page.number)]
12546
n = "fzImg" # 'pymupdf image'
- i = 0
12547
- _imgname = n + "0" # first name candidate
12548
- while _imgname in ilst:
12549
- i += 1
12550
- _imgname = n + str(i) # try new name
12551
-
+ # Use a uuid for uniqueness
+ _imgname = f"{n}{uuid.uuid4()}"
12552
if overlay:
12553
page.wrap_contents() # ensure a balanced graphics state
12554
digests = doc.InsertedImages
0 commit comments