GeezerVison is showing dghs-imgutils.deepghs.org — imgutils.segment.isnetis — imgutils 0.19.0 documentation
imgutils.segment.isnetis
- Overview:
Anime character segmentation, based on https://huggingface.co/skytnt/anime-seg .
get_isnetis_mask
-
imgutils.segment.isnetis.get_isnetis_mask(image: str | PathLike | bytes | bytearray | BinaryIO | Image, scale: int = 1024)[source]
- Overview:
Get mask with isnetis.
- Parameters:
-
- Returns:
Get a mask with all the pixels, which shape is (H, W).
segment_with_isnetis
-
imgutils.segment.isnetis.segment_with_isnetis(image: str | PathLike | bytes | bytearray | BinaryIO | Image, background: str = 'lime', scale: int = 1024)[source]
- Overview:
Segment image with pure color background.
- Parameters:
-
- Returns:
The mask and An RGB image featuring a pure-colored background along with a segmented image.
- Examples::
>>> from imgutils.segment import segment_with_isnetis
>>>
>>> mask_, image_ = segment_with_isnetis('hutao.png')
>>> image_.save('hutao_seg.png')
>>>
>>> mask_, image_ = segment_with_isnetis('skadi.jpg', background='white') # white background
>>> image_.save('skadi_seg.jpg')
The result should be

segment_rgba_with_isnetis
-
imgutils.segment.isnetis.segment_rgba_with_isnetis(image: str | PathLike | bytes | bytearray | BinaryIO | Image, scale: int = 1024)[source]
- Overview:
Segment image with transparent background.
- Parameters:
-
- Returns:
The mask and An RGBA image featuring a transparent background along with a segmented image.
- Examples::
>>> from imgutils.segment import segment_rgba_with_isnetis
>>>
>>> mask_, image_ = segment_rgba_with_isnetis('hutao.png')
>>> image_.save('hutao_seg.png')
>>>
>>> mask_, image_ = segment_rgba_with_isnetis('skadi.jpg')
>>> image_.save('skadi_seg.png')
The result should be
