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

Method add_image

src/__init__.py:2226–2239  ·  view source on GitHub ↗

Add image node (tag "img").

(self, name, width=None, height=None, imgfloat=None, align=None)

Source from the content-addressed store, hash-verified

2224 return child
2225
2226 def add_image(self, name, width=None, height=None, imgfloat=None, align=None):
2227 """Add image node (tag "img")."""
2228 child = self.create_element("img")
2229 if width is not None:
2230 child.set_attribute("width", f"{width}")
2231 if height is not None:
2232 child.set_attribute("height", f"{height}")
2233 if imgfloat is not None:
2234 child.set_attribute("style", f"float: {imgfloat}")
2235 if align is not None:
2236 child.set_attribute("align", f"{align}")
2237 child.set_attribute("src", f"{name}")
2238 self.append_child(child)
2239 return child
2240
2241 def add_link(self, href, text=None):
2242 """Add a hyperlink ("a" tag)"""

Callers

nothing calls this directly

Calls 3

create_elementMethod · 0.95
append_childMethod · 0.95
set_attributeMethod · 0.80

Tested by

no test coverage detected