from PIL import Image

img = Image.open(r"assets\images\shapes\vine-corner-watermark.png").convert("RGBA")
datas = img.getdata()

newData = []
for item in datas:
    # If pixel is near white (e.g. background > 240 in all channels), make it transparent
    r, g, b, a = item
    if r > 240 and g > 240 and b > 240:
        # fade alpha based on brightness
        alpha = max(0, int(a * (1.0 - (min(r, g, b) - 240) / 15.0)))
        newData.append((r, g, b, alpha))
    else:
        newData.append(item)

img.putdata(newData)
img.save(r"assets\images\shapes\vine-corner-watermark.png", "PNG", optimize=True)
print("Processed smooth alpha transparency for vine-corner-watermark.png")
