imgutils.edge.lineart
- Overview:
Get edge with lineart model.
Having the best effect, closest to the drawing lines, but consuming a large amount of memory and computing power at runtime.
get_edge_by_lineart
- imgutils.edge.lineart.get_edge_by_lineart(image: str | PathLike | bytes | bytearray | BinaryIO | Image, coarse: bool = False, detect_resolution: int = 512)[source]
- Overview:
Get edge mask with lineart model.
- Parameters:
image – Original image (assuming its size is
HxW
).coarse – Use coarse model. In the coarse model, the lines will be deeper and richer, but the probability of extra lines or content appearing will increase.
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
- imgutils.edge.lineart.edge_image_with_lineart(image: str | PathLike | bytes | bytearray | BinaryIO | Image, coarse: bool = False, 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
).coarse – Use coarse model. In the coarse model, the lines will be deeper and richer, but the probability of extra lines or content appearing will increase.
detect_resolution – Resolution when passing the image into neural network. Default is
512
.backcolor – Background color the target image. Default is
white
. Whentransparent
is given, the background will be transparent.forecolor – Fore color of the target image. Default is
None
which means use the color from the givenimage
.
- Returns:
An image with the extracted edge from
image
.
- Examples::
When
coarse
is used: