小编Pan*_*ora的帖子

Python PIL 降低 alpha 级别,但不更改透明背景

我想让图像的可见部分更加透明,但也不改变完全透明背景的 Alpha 级别。

这是图片:在此输入图像描述

我这样做:

from PIL import Image
img = Image.open('image_with_transparent_background.png')
img.putalpha(128)
img.save('half_transparent_image_with_preserved_background.png')
Run Code Online (Sandbox Code Playgroud)

这是我得到的:half_transparent_image_with_preserved_background.png

如何在不改变背景的情况下实现我想要的效果?

python png alpha python-imaging-library

4
推荐指数
1
解决办法
2163
查看次数

标签 统计

alpha ×1

png ×1

python ×1

python-imaging-library ×1