{"id":20530370,"url":"https://github.com/zoomten/pil-palette-cycle","last_synced_at":"2026-06-06T11:31:17.316Z","repository":{"id":101809469,"uuid":"267653421","full_name":"ZoomTen/pil-palette-cycle","owner":"ZoomTen","description":"Palette cycling effects with Python + Pillow / PIL","archived":false,"fork":false,"pushed_at":"2020-05-29T02:10:19.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-06T02:24:18.613Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZoomTen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-28T17:29:53.000Z","updated_at":"2023-08-03T20:48:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"e689618e-5d10-4069-820a-f3aec13a6eec","html_url":"https://github.com/ZoomTen/pil-palette-cycle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ZoomTen/pil-palette-cycle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZoomTen%2Fpil-palette-cycle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZoomTen%2Fpil-palette-cycle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZoomTen%2Fpil-palette-cycle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZoomTen%2Fpil-palette-cycle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZoomTen","download_url":"https://codeload.github.com/ZoomTen/pil-palette-cycle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZoomTen%2Fpil-palette-cycle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33981122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-06T02:00:07.033Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T23:36:36.871Z","updated_at":"2026-06-06T11:31:17.298Z","avatar_url":"https://github.com/ZoomTen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Palette Cycling with PIL/Pillow\n\nA simple and terrible hack to make palette cycling effects using Python's PIL / Pillow. Python 3.\n\n## Prerequisites\nInstall PIL and ArgParse:\n```\npip install pillow argparse\n```\n\n## Files\n**Base image** (`base_image.png`):\n\n![Base image](base_image.png)\n\nUse easily-distinguishable colors. The colors on the top left of the sample base image are only as a guide.\n\nMake sure to save it as **PNG with alpha channel**!\n\n**Palette definitions** (`colors.txt`):\n```\nbase  ff0000 ff0086 ec00ff 7700ff 0047ff 00c7ff 00f4ff 00ff7f 0e6f09 51cb00 b3cb00 cb9b00 cb5d00\ndir   left\ncycle eefaff d8f5ff c0efff a4e8ff 8ee2ff 8de1ff 55d2ff 88e0ff 9fe6ff b6ecff d2f3ff e8f9ff ffffff\n```\n* The `base` command specifies which colors to use for the base palette, sequentially.\n* `dir` tells the direction which the palette should cycle through\n* `cycle` command specifies which colors to map to each entry specified in `base`. The amount of colors here **must** match the `base` colors!\n\n## Generating the animation\nExplanation of `palette_cycle.sh` follows...\n\nMake a folder to dump the generated images:\n```\nmkdir palette_anim\n```\n\nGenerate the images:\n```\npython cycle_colors.py base_image.png colors.txt palette_anim/_palette_anim\n```\nAfter this command is run, you should see a bunch of images in the `palette_anim` folder.\n\nCreate the animation (avi, gif):\n```\nffmpeg -framerate 6 -i palette_anim/_palette_anim_%01d.png -c:v huffyuv -y -an _palette_anim.avi\nffmpeg -i _palette_anim.avi -vf \"palettegen=reserve_transparent=0\" -y _palette_anim_palette.png\nffmpeg -i _palette_anim.avi -i _palette_anim_palette.png -lavfi paletteuse -r 6 -y _palette_anim.gif\n```\nThis first creates the avi, then makes a gif from the avi.\n\nRemove the avi:\n```\nrm _palette_anim.avi\n```\n\nRemove the palette:\n```\nrm _palette_anim_palette.png\n```\n\nRemove the image directory:\n```\nrm -r palette_anim\n```\n\n## Result\n![Palette cycle](_palette_anim.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoomten%2Fpil-palette-cycle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzoomten%2Fpil-palette-cycle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoomten%2Fpil-palette-cycle/lists"}