Created
May 12, 2025 17:49
-
-
Save maekoos/2e8ee8cba17b279059ebe19f3b094f82 to your computer and use it in GitHub Desktop.
Convert cllor swatches/palettes from GIMP (.gpl) to Adobe (.ase)
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
| import swatch | |
| colors = [] | |
| with open("input.gpl", "r") as f: | |
| # Skip "GIMP Palette" and "Name:" | |
| lines = f.readlines()[2:] | |
| for ln in lines: | |
| if ln.startswith("#"): | |
| continue | |
| r, g, b, name = ln.strip().split(None, 3) | |
| print(r, g, b, name) | |
| colors.append( | |
| { | |
| "name": name, | |
| "type": "Process", | |
| "data": { | |
| "mode": "RGB", | |
| "values": [float(r) / 255, float(g) / 255, float(b) / 255], | |
| }, | |
| } | |
| ) | |
| swatch.write(colors, "output.ase") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment