def read ( self ) : stream = BytesIO ( ) self . cam . capture ( stream , format = 'png' ) # "Rewind" the stream to the beginning so we can read its content stream . seek ( 0 ) return Image . open ( stream )
python pil camera capture
https : // picamera . readthedocs . io / en / release - 1 . 13 / recipes1 . html#capturing - to - a - pil - image
def read(self):
        """https://picamera.readthedocs.io/en/release-1.13/recipes1.html#capturing-to-a-pil-image"""
        stream = BytesIO()
        self.cam.capture(stream, format='png')
        # "Rewind" the stream to the beginning so we can read its content
        stream.seek(0)
        return Image.open(stream)