Be aware that the previews provided by that program are limited to the functionality of SVG gradients and may not be representative of exactly how a GIMP gradient would appear in actual use.
For example, the following GIMP image shows six different possible blends from red to blue; however, only the top one can be produced with an SVG gradient. GIMP is also able to mix segments of these different types within a single gradient.
Attachment:
blends.jpg [ 23.17 KiB | Viewed 1447 times ]
Unfortunately, GIMP does not provide a means for a plug-in to load individual gradients and so in order to generate previews it is necessary to play around with the contents of the directories that GIMP loads its gradients from.
I have written a shell script (in the spoiler tags below) that uses GIMP to generate an XCF file containing a preview layer for each gradient in a specified directory. (
EDIT: the script is now available for download from here.) The script is invoked from the command line (GNU/Linux only) as follows:
./preview-gradients.sh /path/to/gradients/ filename.xcfYou can save the script as something other than 'preview-gradients.sh' if you wish. Remember to make the script executable (using 'chmod +x preview-gradients.sh' or somesuch).
Here is a screenshot of the image that is produced from a directory containing three .ggr files:
Attachment:
layerstack.jpg [ 301.6 KiB | Viewed 1447 times ]
#!/usr/bin/env bash
if [ $# -ne 2 ] ; then
echo Usage: $0 gradient-folder savefile.xcf
exit 1
fi
G2_DATADIR=$(mktemp -d -t gimp.XXXXXX)
ORIG_DATADIR=${GIMP2_DATADIR:-/usr/share/gimp/2.0}
cp -rf $ORIG_DATADIR/* $G2_DATADIR
rm -rf $G2_DATADIR/gradients/* 2>/dev/null
cp -f $1/*.ggr $G2_DATADIR/gradients
tee $G2_DATADIR/scripts/preview.scm >/dev/null <<EOF
(define (preview-grad xcf-filename)
(define PREVIEW-SIZE 800)
(let ((image (car (gimp-image-new PREVIEW-SIZE PREVIEW-SIZE RGB))))
(gimp-image-undo-disable image)
(let ((loaded-gradients (cadr (gimp-gradients-get-list ""))))
(gimp-gradients-refresh)
(let loop ((gradients (cadr (gimp-gradients-get-list ""))))
(unless (null? gradients)
(if (member (car gradients) loaded-gradients)
(loop (cdr gradients))
(let ((layer (car (gimp-layer-new image
PREVIEW-SIZE
PREVIEW-SIZE
RGB-IMAGE
"layer"
100
NORMAL-MODE ))) )
(gimp-image-add-layer image layer 0)
(gimp-context-set-foreground '(102 102 102))
(gimp-context-set-background '(153 153 153))
(plug-in-checkerboard RUN-NONINTERACTIVE image layer 0 (/ PREVIEW-SIZE 100))
(gimp-context-set-default-colors)
(gimp-drawable-set-name layer (car gradients))
(let ((name (car gradients)))
(gimp-context-set-gradient name)
(gimp-rect-select image 0 0 (/ PREVIEW-SIZE 2) (/ PREVIEW-SIZE 2)
CHANNEL-OP-REPLACE FALSE 0 )
(gimp-edit-blend layer CUSTOM-MODE NORMAL-MODE GRADIENT-LINEAR 100
0 REPEAT-NONE FALSE TRUE 3 3 FALSE
0 0 (/ PREVIEW-SIZE 2) 0 )
(gimp-rect-select image (/ PREVIEW-SIZE 2) 0 (/ PREVIEW-SIZE 2) (/ PREVIEW-SIZE 2)
CHANNEL-OP-REPLACE FALSE 0 )
(gimp-edit-blend layer CUSTOM-MODE NORMAL-MODE GRADIENT-RADIAL 100
0 REPEAT-NONE FALSE TRUE 3 3 FALSE
(* 0.75 PREVIEW-SIZE) (* 0.25 PREVIEW-SIZE)
(* 0.75 PREVIEW-SIZE) (* 0.5 PREVIEW-SIZE) )
(gimp-rect-select image 0 (/ PREVIEW-SIZE 2) (/ PREVIEW-SIZE 2) (/ PREVIEW-SIZE 2)
CHANNEL-OP-REPLACE FALSE 0 )
(gimp-edit-blend layer CUSTOM-MODE NORMAL-MODE GRADIENT-CONICAL-ASYMMETRIC 100
0 REPEAT-NONE FALSE TRUE 3 3 FALSE
(* 0.25 PREVIEW-SIZE) (* 0.75 PREVIEW-SIZE)
(* 0.25 PREVIEW-SIZE) (/ PREVIEW-SIZE 2) )
(gimp-rect-select image (/ PREVIEW-SIZE 2) (/ PREVIEW-SIZE 2) (/ PREVIEW-SIZE 2) (/ PREVIEW-SIZE 2)
CHANNEL-OP-REPLACE FALSE 0 )
(gimp-edit-blend layer CUSTOM-MODE NORMAL-MODE GRADIENT-SPIRAL-CLOCKWISE 100
0 REPEAT-NONE FALSE TRUE 3 3 FALSE
(* 0.75 PREVIEW-SIZE) (* 0.75 PREVIEW-SIZE)
(* 0.75 PREVIEW-SIZE) (/ PREVIEW-SIZE 2) )
(gimp-selection-none image) )
(loop (cdr gradients)) )))))
(gimp-xcf-save 0 image (car (gimp-image-get-active-layer image)) xcf-filename xcf-filename)
(gimp-image-delete image)
(gimp-quit 0)
))
EOF
export GIMP2_DIRECTORY=$(mktemp -d -t gimp.XXXXXX)
mkdir $GIMP2_DIRECTORY/gradients -p
mkdir $GIMP2_DIRECTORY/patterns -p
mkdir $GIMP2_DIRECTORY/brushes -p
GIMP2_DATADIR=$G2_DATADIR gimp -i -n -d -b "(preview-grad \"$2\")"
rm -rf $G2_DATADIR
rm -rf $GIMP2_DIRECTORY
exit 0