25 lines
764 B
Python
25 lines
764 B
Python
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")
|