Previously, I had developed a small script to take an image and turn it into a GIMP gradient. This was mainly due to my desire to convert some of these tonal gradients into actual GIMP gradients. This script was posted to the gimp-plugin[?] repository by someone else (with my permission) but seems to have been removed.
My work with paths when creating the tapered stroke script got me thinking about making a script that could sample along a path and create a gradient.
I developed this with GIMP 2.6 but it should also work fine with 2.4. This script registers itself in the gradient menu. I figured I should try to follow the new script/plugin[?] naming direction and not just pile it under "Script-fu". Just load up an image (or make one) and draw a path on it (or import one from Inkscape, or generate one using this really handy Shape Paths script). Here is a sample image and the path I created using the shape path script:
Access the script by getting the gradients menu by clicking the leftward pointing arrow in the gradients dialog, then selecting Gradients Menu, then Sample Gradient along a Path...:
The dialog options are simple... The image, the Layer (these are required), the path, the number of samples to take, the radius to average at each sample point, an option to make the gradient smooth, and the name for the new gradient. The "Smooth Gradient" option will set the blending so each sample linearly blends to the next. Un-checking this will create a gradient of distinct bands from the colour at each sample point:
And the resulting gradient (viewed in the gradient editor):
Sampling along a circular path like this was an easy way to create a sine wave gradient from a linear gradient. Other handy uses are sampling the sky from a photo to get a gradient you can use in other images, or grabbing hypsometric tints or false colour gradients from existing images.
You can download the script here.
Juse made a small change to my script Sample Gradient Along a Path. There was a small bug that would cause the scipt to error when the path being sampled extended beyong the image boundary. Now it clamps the path location to the edges in such a case. T
Tracked: Jun 25, 14:09