imgutils.edge.lineart_anime

Overview:

Get edge with lineart anime model.

get_edge_by_lineart_anime

imgutils.edge.lineart_anime.get_edge_by_lineart_anime(image: str | PathLike | bytes | bytearray | BinaryIO | Image, detect_resolution: int = 512)[source]
Overview:

Get edge mask with lineart anime model.

Parameters:
  • image – Original image (assuming its size is HxW).

  • detect_resolution – Resolution when passing the image into neural network. Default is 512.

Returns:

A mask with format float32[H, W].

edge_image_with_lineart_anime

imgutils.edge.lineart_anime.edge_image_with_lineart_anime(image: str | PathLike | bytes | bytearray | BinaryIO | Image, detect_resolution: int = 512, backcolor: str = 'white', forecolor: str | None = None)[source]
Overview:

Get an image with the extracted edge from image.

Parameters:
  • image – Original image (assuming its size is HxW).

  • detect_resolution – Resolution when passing the image into neural network. Default is 512.

  • backcolor – Background color the target image. Default is white. When transparent is given, the background will be transparent.

  • forecolor – Fore color of the target image. Default is None which means use the color from the given image.

Returns:

An image with the extracted edge from image.

Examples::
../../_images/lineart_anime.plot.py.svg