class_docstr: Base class for a Pillow `Image` that can show itself and convert to a Tensor
class_docstr_tok: ["Base","class","for","a","Pillow","`","Image","`","that","can","show","itself","and","convert","to","a","Tensor"]
docstr: Return an Image from `fn`
docstr_tok: ["Return","an","Image","from","`","fn","`"]
code: def create(
      cls,
      fn: Path | str | Tensor | ndarray | bytes | Image.Image,
      **kwargs,
  ):
      "Return an Image from `fn`"
      if isinstance(fn, TensorImage):
          fn = fn.permute(1, 2, 0).type(torch.uint8)
      if isinstance(fn, TensorMask):
          fn = fn.type(torch.uint8)
      if isinstance(fn, Tensor):
          fn = fn.numpy()
      if isinstance(fn, ndarray):
          return cls(Image.fromarray(fn))
      if isinstance(fn, bytes):
          fn = io.BytesIO(fn)
      if isinstance(fn, Image.Image):
          return cls(fn)
      return cls(load_image(fn, **merge(cls._open_args, kwargs)))
  
imports: from __future__ import annotations
  from ..torch_basics import *
  from ..data.all import *
  from PIL import Image
  from matplotlib import patches, patheffects
label_desc: Use image node_id 1 for calling the PILBase obj's underlying member method code with example usage: obj.create(cls, fn) and returns: cls, cls, cls