#!/usr/bin/env python3 """Prints the icon sizes Chrome stored for installed web apps in a profile.""" import collections import glob import os import sys from PIL import Image profile = sys.argv[1] pattern = os.path.join(profile, "Default", "Web Applications", "Manifest Resources", "*", "*", "*.png") sizes = collections.defaultdict(list) for path in glob.glob(pattern): width, height = Image.open(path).size sizes[os.path.basename(os.path.dirname(path))].append( width if width == height else f"{width}x{height}") for folder in sorted(sizes): print(f" {folder:16} {sorted(sizes[folder], key=lambda s: s if isinstance(s, int) else 10**6)}")