import shutil
from PIL import Image

def process_logo():
    src_path = "/Users/apple/.gemini/antigravity-ide/brain/822556bd-47a7-4c07-8975-803618af0a3a/media__1781942586218.png"
    
    # 1. Copy original logo
    shutil.copy(src_path, "public/logo.png")
    shutil.copy(src_path, "public/images/logo.png")
    print("Copied original logo.png to public/ and public/images/")
    
    # 2. Create purple version of the logo
    img = Image.open(src_path).convert("RGBA")
    pixels = img.load()
    width, height = img.size
    
    # Target purple: RGB (102, 37, 130) -> Hex #662582
    # We will recolor all white/near-white pixels to purple, preserving their original alpha channel.
    for x in range(width):
        for y in range(height):
            r, g, b, a = pixels[x, y]
            if a > 0:
                # If pixel is white or very close to white
                if r > 220 and g > 220 and b > 220:
                    pixels[x, y] = (102, 37, 130, a)
                    
    img.save("public/logo-purple.png", "PNG")
    img.save("public/images/logo-purple.png", "PNG")
    print("Created logo-purple.png in public/ and public/images/")

if __name__ == "__main__":
    process_logo()
