def pil_image(source, exif_orientation=True, **options):
 if (not source):
  return
 source = BytesIO(source.read())
 image = Image.open(source)
 try:
  image.load()
 except IOError:
  pass
 image.load()
 if exif_orientation:
  image = utils.exif_orientation(image)
 return image

def pil_image ( source , exif_orientation = True , ** options ) : if ( not source ) : return source = BytesIO ( source . read ( ) ) image = Image . open ( source ) try : image . load ( ) except IOError : pass image . load ( ) if exif_orientation : image = utils . exif_orientation ( image ) return image
try to open the source file directly using pil .