29 lines
1.1 KiB
Python
29 lines
1.1 KiB
Python
from PIL import Image
|
|
|
|
def inspect_icon_pixels(path):
|
|
img = Image.open(path)
|
|
pixels = img.convert("RGBA").load()
|
|
width, height = img.size
|
|
|
|
non_bg_coords = []
|
|
|
|
for x in range(150):
|
|
for y in range(height):
|
|
r, g, b, a = pixels[x, y]
|
|
# Check if it is NOT white background (defining background as r >= 250, g >= 250, b >= 250)
|
|
is_bg = (r >= 250 and g >= 250 and b >= 250)
|
|
if not is_bg:
|
|
non_bg_coords.append((x, y))
|
|
|
|
if non_bg_coords:
|
|
xs = [p[0] for p in non_bg_coords]
|
|
ys = [p[1] for p in non_bg_coords]
|
|
print(f"Non-background bounding box on left:")
|
|
print(f"X: {min(xs)} to {max(xs)} (width={max(xs) - min(xs) + 1})")
|
|
print(f"Y: {min(ys)} to {max(ys)} (height={max(ys) - min(ys) + 1})")
|
|
else:
|
|
print("All pixels in the left region are background.")
|
|
|
|
if __name__ == "__main__":
|
|
inspect_icon_pixels("/Users/apple/.gemini/antigravity-ide/brain/822556bd-47a7-4c07-8975-803618af0a3a/media__1781946188768.png")
|