Skip to content

函数png_rgba_black_preprocess的函数名命名与实际实现不一致 #313

Description

@CNWeiWei

函数png_rgba_black_preprocess的函数名命名与实际实现不一致:

def png_rgba_black_preprocess(img: Image.Image) -> Image.Image:
"""
处理PNG图片的RGBA透明背景,将透明部分设置为白色背景

Args:
    img: PIL Image对象
    
Returns:
    处理后的PIL Image对象
    
Raises:
    ImageProcessError: 当图片处理失败时
"""
try:
    width = img.width
    height = img.height
    image = Image.new('RGB', size=(width, height), color=(255, 255, 255))
    image.paste(img, (0, 0), mask=img)
    return image
except Exception as e:
    raise ImageProcessError(f"PNG透明背景处理失败: {str(e)}") from e

所属模块utils/image_io.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions