from os import listdir import subprocess subprocess.run(["convert", "favicon.png", "-resize", f"48x48", "public/favicon.ico"]) ICONS_BASE_PATH = "app/javascript/icons/" for icon in listdir(ICONS_BASE_PATH): size = int(icon.split("x")[-1].split(".")[0]) subprocess.run(["convert", "favicon.png", "-resize", f"{size}x{size}", ICONS_BASE_PATH + icon])