Converting PNG32 to PNG8 with PIL while preserving transparency

前端 未结 4 967
悲哀的现实
悲哀的现实 2020-12-16 04:48

I would like to convert a PNG32 image (with transparency) to PNG8 with Python Image Library. So far I have succeeded converting to PNG8 with a solid background.

Belo

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-16 05:15

    Don't use PIL to generate the palette, as it can't handle RGBA properly and has quite limited quantization algorithm.

    Use pngquant instead.

提交回复
热议问题