Initial commit
This commit is contained in:
24
scratch/inspect_glob.py
Normal file
24
scratch/inspect_glob.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from PIL import Image
|
||||
|
||||
def inspect_image(path):
|
||||
img = Image.open(path)
|
||||
print("Mode:", img.mode)
|
||||
print("Size:", img.size)
|
||||
|
||||
# Check some pixels
|
||||
pixels = img.convert("RGBA").load()
|
||||
width, height = img.size
|
||||
|
||||
color_counts = {}
|
||||
for x in range(0, width, max(1, width // 20)):
|
||||
for y in range(0, height, max(1, height // 20)):
|
||||
r, g, b, a = pixels[x, y]
|
||||
color = (r, g, b, a)
|
||||
color_counts[color] = color_counts.get(color, 0) + 1
|
||||
|
||||
print("Sample pixels:")
|
||||
for color, count in sorted(color_counts.items(), key=lambda x: x[1], reverse=True)[:10]:
|
||||
print(f"Color: {color}, count: {count}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
inspect_image("public/images/slider-glob.png")
|
||||
Reference in New Issue
Block a user