ggr

Ggr.py reads Gimp .ggr gradient files, providing a Python interface to get color values from them. There are only two methods on GimpGradient:

>>> import ggr
>>> g = ggr.GimpGradient('Sunrise.ggr')
>>> g.color(.25)
(0.95501612668614855, 0.91457275670187077, 0.74046874445166)
>>> g.color(.5)
(0.83733161389613664, 0.37510844064480114, 0.23112679845322415)
>>> g.color(.75)
(0.42744738324707615, 0.52517311887199969, 0.83543339174375486)

This Python code is in the public domain.

Download: ggr.py

See also

Comments

[gravatar]
So you won't mind if I steal portions of it for PIL, then? ;-)

Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
Comment text is Markdown.