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)
| 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. |