如果我打開下圖所示的圖像,是否可以展開白色像素?展開白色像素python中的圖像處理
僞代碼:
image = Image.open("test.png")
image = image.convert("RGBA")
my_data = image.getdata()
new_data = []
for i in my_data:
if i[0] == 255 and i[1] == 255 and i[2] == 255:
#append white to new_data + to the pixels around
else:
new_data.append((255, 255, 255, 0))
謝謝