code: def as_pil_image(self):
          
          from PIL import Image
  
          try:
              bio = BytesIO()
              self._extract_direct(stream=bio)
              bio.seek(0)
              return Image.open(bio)
          except UnsupportedImageTypeError:
              pass
  
          im = self._extract_transcoded()
          if not im:
              raise UnsupportedImageTypeError(repr(self))
  
          return im
docs: Extract the image as a Pillow Image, using decompression as necessary
  
          Returns:
              PIL.Image.Image