MCPcopy Index your code
hub / github.com/pymupdf/PyMuPDF / pil_save

Method pil_save

src/__init__.py:13759–13772  ·  view source on GitHub ↗

Write to image file using Pillow. An intermediate PIL Image is created, and its "save" method is used to store the image. See Pillow documentation to learn about the meaning of possible positional and keyword parameters. Use this when other output formats are desired

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

13757 return img
13758
13759 def pil_save(self, *args, **kwargs):
13760 """Write to image file using Pillow.
13761
13762 An intermediate PIL Image is created, and its "save" method is used
13763 to store the image. See Pillow documentation to learn about the
13764 meaning of possible positional and keyword parameters.
13765 Use this when other output formats are desired.
13766 """
13767 img = self.pil_image()
13768
13769 if "dpi" not in kwargs.keys():
13770 kwargs["dpi"] = (self.xres, self.yres)
13771
13772 img.save(*args, **kwargs)
13773
13774 def pil_tobytes(self, *args, **kwargs):
13775 """Convert to an image in memory using Pillow.

Callers

nothing calls this directly

Calls 2

pil_imageMethod · 0.95
saveMethod · 0.45

Tested by

no test coverage detected