Created
November 2, 2025 23:52
-
-
Save hasansezertasan/cba2a1270f1f8ec4066d4674a7520dde to your computer and use it in GitHub Desktop.
Convert PNG to ICO format. Also, did you know that ICO format can have multiple size of image in itself, I didn't...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /// script | |
| # requires-python = ">=3.12" | |
| # dependencies = ["pillow"] | |
| # /// | |
| from PIL import Image | |
| def main() -> None: | |
| with Image.open("icon.png") as img: | |
| img.save( | |
| "icon.ico", | |
| format="ICO", | |
| sizes=[ | |
| (16, 16), | |
| (24, 24), | |
| (32, 32), | |
| (48, 48), | |
| (64, 64), | |
| (128, 128), | |
| (256, 256), | |
| ], | |
| ) | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment