How to convert this indexed PNG to grayscale and keep transparency, using Python and Pillow?
- 阅读更多 关于 How to convert this indexed PNG to grayscale and keep transparency, using Python and Pillow?
问题 I am trying to convert images to grayscale using Python/Pillow. I had no difficulty in most images, but then, while testing with different images, I found this logo from the BeeWare project, that I know that has been further edited with some image editor and recompressed using ImageOptim. The image has some kind of transparency (in the whole white area around the bee), but black color gets messed up. Here is the code: #/usr/bin/env python3 import os from PIL import Image, ImageFile src_path =