This commit is contained in:
@ -1278,6 +1278,19 @@ class ImageFilterImplement:
|
||||
|
||||
return Image.fromarray(image_arr, 'RGBA')
|
||||
|
||||
# 设置遮罩
|
||||
def apply_set_mask(image: Image.Image, mask_image: Image.Image) -> Image.Image:
|
||||
if image.mode != 'RGBA':
|
||||
image = image.convert('RGBA')
|
||||
|
||||
if mask_image.mode != 'L':
|
||||
mask_image = mask_image.convert('L')
|
||||
|
||||
# 应用遮罩
|
||||
image.putalpha(mask_image.resize(image.size, Image.Resampling.LANCZOS))
|
||||
|
||||
return image
|
||||
|
||||
@staticmethod
|
||||
def generate_empty(image: Image.Image, images: list[Image.Image], width: int = 512, height: int = 512) -> Image.Image:
|
||||
# 生成空白图像
|
||||
|
||||
Reference in New Issue
Block a user