Initial commit
This commit is contained in:
22
scratch/inspect_purple_logo.py
Normal file
22
scratch/inspect_purple_logo.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from PIL import Image
|
||||
|
||||
def inspect_purple_logo(path):
|
||||
img = Image.open(path)
|
||||
print("Size:", img.size)
|
||||
pixels = img.convert("RGBA").load()
|
||||
width, height = img.size
|
||||
|
||||
colors = {}
|
||||
for x in range(60, width):
|
||||
for y in range(height):
|
||||
r, g, b, a = pixels[x, y]
|
||||
if a > 0:
|
||||
color = (r, g, b, a)
|
||||
colors[color] = colors.get(color, 0) + 1
|
||||
|
||||
print("Non-transparent pixels in the text region (x >= 60):")
|
||||
for color, count in sorted(colors.items(), key=lambda x: x[1], reverse=True)[:10]:
|
||||
print(f"Color: {color}, count: {count}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
inspect_purple_logo("public/logo-purple.png")
|
||||
Reference in New Issue
Block a user