Я пытаюсь конвертировать
Код: Выделить всё
pngКод: Выделить всё
bmp
Here's my code:
Код: Выделить всё
from PIL import Image
import os
def convert_to_indexed_bmp(input_image_path, output_bmp_path):
img = Image.open(input_image_path)
indexed_background_color = (0, 255, 0)
img_with_indexed_background = Image.new("RGBA", img.size, indexed_background_color)
img_with_indexed_background.paste(img, (0, 0), img)
img_indexed = img_with_indexed_background.convert("RGB").convert("P", palette=Image.ADAPTIVE, colors=256)
img_indexed.save(output_bmp_path)
input_folder = "splash.png"
output_folder = "splash.bmp"
convert_to_indexed_bmp(input_folder, output_folder)
Источник: https://stackoverflow.com/questions/781 ... ansparency