Files
nearle_web_nextjs/scratch/analyze_coords.py
2026-06-20 15:41:55 +05:30

33 lines
1.1 KiB
Python

from PIL import Image
def analyze_coords(path):
img = Image.open(path)
pixels = img.convert("RGBA").load()
width, height = img.size
# Track the x-coordinates of white pixels (r=255, g=255, b=255, a>0)
white_x = []
purple_x = []
for x in range(width):
for y in range(height):
r, g, b, a = pixels[x, y]
if a > 0:
if r == 255 and g == 255 and b == 255:
white_x.append(x)
elif r == 102 and g == 37 and b == 130:
purple_x.append(x)
if white_x:
print(f"White pixels: count={len(white_x)}, x-range=[{min(white_x)}, {max(white_x)}]")
else:
print("No white pixels found.")
if purple_x:
print(f"Purple pixels: count={len(purple_x)}, x-range=[{min(purple_x)}, {max(purple_x)}]")
else:
print("No purple pixels found.")
if __name__ == "__main__":
analyze_coords("/Users/apple/.gemini/antigravity-ide/brain/822556bd-47a7-4c07-8975-803618af0a3a/media__1781942586218.png")