from PIL import Image

def analyze_first_logo(path):
    img = Image.open(path)
    pixels = img.convert("RGBA").load()
    width, height = img.size
    print("Mode:", img.mode)
    print("Size:", img.size)
    
    # Bounding box for icon on the left (x < 60)
    xs_icon = []
    ys_icon = []
    for x in range(60):
        for y in range(height):
            r, g, b, a = pixels[x, y]
            # Purple icon has color like (102, 37, 130)
            if a > 0 and (r < 150 and g < 100 and b > 100):
                xs_icon.append(x)
                ys_icon.append(y)
                
    if xs_icon:
        print(f"First Logo Icon bounding box:")
        print(f"X: {min(xs_icon)} to {max(xs_icon)} (width={max(xs_icon) - min(xs_icon) + 1})")
        print(f"Y: {min(ys_icon)} to {max(ys_icon)} (height={max(ys_icon) - min(ys_icon) + 1})")
    else:
        print("No purple pixels found in left region.")
        
    # Bounding box for white text in the middle/right (x >= 60)
    xs_text = []
    ys_text = []
    for x in range(60, width):
        for y in range(height):
            r, g, b, a = pixels[x, y]
            # White text is transparent white or opaque white
            if a > 0 and (r > 240 and g > 240 and b > 240):
                xs_text.append(x)
                ys_text.append(y)
                
    if xs_text:
        print(f"First Logo Text bounding box:")
        print(f"X: {min(xs_text)} to {max(xs_text)} (width={max(xs_text) - min(xs_text) + 1})")
        print(f"Y: {min(ys_text)} to {max(ys_text)} (height={max(ys_text) - min(ys_text) + 1})")
    else:
        print("No white pixels found in right region.")

if __name__ == "__main__":
    analyze_first_logo("/Users/apple/.gemini/antigravity-ide/brain/822556bd-47a7-4c07-8975-803618af0a3a/media__1781948467684.png")
