私は画像処理スクリプト(ライブラリを使用)に取り組んでおり、画像Python
のPIL
色空間を に変換する必要がありますRGB
。このトリックを試しましたが、色空間png
の画像でのみ機能します。RGBa
image = Image.open(imageFile)
image.load()
# replace alpha channel with white color
self.im = Image.new('RGB', image.size, (255, 255, 255))
self.im.paste(image, mask=image.split()[3])
このコードを任意の色空間のすべての画像に普遍的に作成する方法は?
ありがとう。