You are here

Four-corner gradient

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!

Version 2.4

This Script-Fu creates a completely new image having an RGB and/or HSV gradient in two directions - both horizontally and vertically - based on the colors you specify for the four corners. The layer name includes the parameters to support reproducibility.

Superceded as of 4/26/09 by 2-Dimensional Gradient.

Version 2.4: layer name color parameters shown in hex to facilitate copying into color widget. Thanks to Saul Goode for code that lets me enable this feature.
Version 2.2: layer name includes all parameters except width and height, to facilitate reproducibility.
Version 2.0: defaults to most efficient execution sequence; adds cycling.

Tip: Because the logic of this script involves processing one column or row at a time, you may want to test on a smaller image until you find a desirable gradient, then create a larger image using the same settings.

If you choose RGB for both directions or HSV for both directions, the sequence does not matter, so you might as well let the program choose the most efficient direction.

If you mix RGB in one direction with HSV in the other, the processing sequence - RGB first or HSV first - will affect the appearance of your resulting image. If you've mixed them, you may want to try forcing a particular sequence for applying the gradients.

Once you've saved this Script-Fu in your Script-Fu directory, you will find it filed under Filters > Render > Gradients > 4-corner Gradient 2.0...

Known issue: The script may occasionally quit with an error when setting the foreground color. Re-running the script with the same parameters seems to fix the problem.

Known issue: As of GIMP 2.6.6, the programming interface provided by GIMP does not support scripting control over HSV gradient directionality (clockwise vs. counter-clockwise hue). Therefore, the choice of the directionality of such gradients may appear arbitrary - and may even be arbitrary. Occasionally, you may find that certain uses of the HSV settings in the Four-corner gradient Script-Fu may result in two adjacent rows or columns of pixels following the opposite hue directionality. There is nothing to be done about this at this time except, if you find the resulting image not useful, to try other settings.

The image in my profile was created from Four-corner gradient version 2.0 Script-Fu with settings: 85 85 ff0000 00ff12 00bfff ffaf14 HSV No cycling RGB No cycling Left/right edges first.

sample four-color gradient image

fourcorner.scm7.87 KB
GIMP Version: 
Code License: 


In order to become more proficient at coding Script-Fu, I've made some adjustments to the code.
Subscribe to Comments for "Four-corner gradient"