def _pil_props(self): """ A tuple containing useful image properties extracted from this image using Pillow (Python Imaging Library, or 'PIL'). """ stream = BytesIO(self._blob) pil_image = PIL_Image.open(stream) format = pil_image.format width_px, height_px = pil_image.size dpi = pil_image.info.get("dpi") stream.close() return (format, (width_px, height_px), dpi)
def when_open_presentation_stream(context): with open(test_pptx("test"), "rb") as f: stream = BytesIO(f.read()) context.prs = Presentation(stream) stream.close()
def when_open_presentation_stream(context): with open(test_pptx('test'), 'rb') as f: stream = BytesIO(f.read()) context.prs = Presentation(stream) stream.close()