code: def from_file(cls, image_file):
          
          if is_string(image_file):
              # treat image_file as a path
              with open(image_file, 'rb') as f:
                  blob = f.read()
              filename = os.path.basename(image_file)
          else:
              # assume image_file is a file-like object
              # ---reposition file cursor if it has one---
              if callable(getattr(image_file, 'seek')):
                  image_file.seek(0)
              blob = image_file.read()
              filename = None
  
          return cls.from_blob(blob, filename)
docs: Return a new |Image| object loaded from *image_file*, which can be
          either a path (string) or a file-like object.