MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / delete_image

Function delete_image

src_classic/utils.py:277–288  ·  view source on GitHub ↗

Delete the image referred to by xef. Actually replaces by a small transparent Pixmap using method Page.replace_image. Args: xref: xref of the image to delete.

(page: Page, xref: int)

Source from the content-addressed store, hash-verified

275
276
277def delete_image(page: Page, xref: int):
278 """Delete the image referred to by xef.
279
280 Actually replaces by a small transparent Pixmap using method Page.replace_image.
281
282 Args:
283 xref: xref of the image to delete.
284 """
285 # make a small 100% transparent pixmap (of just any dimension)
286 pix = fitz_old.Pixmap(fitz_old.csGRAY, (0, 0, 1, 1), 1)
287 pix.clear_with() # clear all samples bytes to 0x00
288 page.replace_image(xref, pixmap=pix)
289
290
291def insert_image(page, rect, **kwargs):

Callers

nothing calls this directly

Calls 2

clear_withMethod · 0.95
replace_imageMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…