Created 15 September 2007
Ggr.py reads Gimp .ggr gradient files, providing a Python interface to get color values from them. There are only two methods on GimpGradient:
- read(f) reads a .ggr file from f, either an open file or a file path. The constructor also take an optional file to read as an argument.
- color(pos) takes a position between 0 and 1 and returns the rgb color at that point along the gradient.
>>> import ggr
>>> g = ggr.GimpGradient('Sunrise.ggr')
(0.95501612668614855, 0.91457275670187077, 0.74046874445166)
(0.83733161389613664, 0.37510844064480114, 0.23112679845322415)
(0.42744738324707615, 0.52517311887199969, 0.83543339174375486)
This Python code is in the public domain.
Add a comment: