22 lines
751 B
Python
22 lines
751 B
Python
from PIL import Image
|
|
|
|
def analyze_bag_colors(path):
|
|
img = Image.open(path)
|
|
pixels = img.convert("RGBA").load()
|
|
|
|
# Let's inspect columns near the logo, e.g. x = 800 (just left of logo)
|
|
# and x = 975 (just right of logo)
|
|
print("Purple bag colors near logo:")
|
|
colors = {}
|
|
for y in range(160, 410, 10):
|
|
# Left side
|
|
colors[pixels[800, y]] = colors.get(pixels[800, y], 0) + 1
|
|
# Right side
|
|
colors[pixels[970, y]] = colors.get(pixels[970, y], 0) + 1
|
|
|
|
for color, count in sorted(colors.items(), key=lambda x: x[1], reverse=True)[:10]:
|
|
print(f"Color: {color}, count: {count}")
|
|
|
|
if __name__ == "__main__":
|
|
analyze_bag_colors("public/images/slider-courier-mask-purple.png")
|