Skip to content

Instantly share code, notes, and snippets.

@maekoos
Created May 12, 2025 17:49
Show Gist options
  • Select an option

  • Save maekoos/2e8ee8cba17b279059ebe19f3b094f82 to your computer and use it in GitHub Desktop.

Select an option

Save maekoos/2e8ee8cba17b279059ebe19f3b094f82 to your computer and use it in GitHub Desktop.
Convert cllor swatches/palettes from GIMP (.gpl) to Adobe (.ase)
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