Skip to content

IR gradients

Matt Painter edited this page Nov 8, 2020 · 20 revisions

When applying IR colour enhancement using the -c / --clut option, a JSON gradient file is read and mapped to IR pixel intensity. To use a specific gradient, use -g / --gradient with the gradient's path.

Sample usage

sanchez -o output\geostationary -s sample-images -c 0-1 -g Resources\Gradients\Purple-Yellow.json

Included gradients

The following gradient definitions are included in Sanchez. If you have a gradient that you think is worthy of inclusion, feel free to let me know.

Red/blue

This is the default gradient if none is specified via -g / --gradient. It's defined in Resources/Gradients/red-blue.json:

Blue/red gradient

Purple/yellow

Alternative gradient, defined in Resources/Gradients/purple-yellow.json:

Purple/yellow gradient

Custom gradients

Gradient files contain a list of RGB tuples and positions ranging from 0.0 - 1.0. Each gradient file should ideally have at least two colours - one at position 0.0 and one colour at position 1.0.

Colours are interpolated using CIE L*C*h for aesthetically pleasing results, so only key colours are required to be included.

Example gradient file structure:

[
  {
    "Colour": "ffffb2",
    "Position": 0.0
  },
  {
    "Colour": "fecc5c",
    "Position": 0.25
  },
  {
    "Colour": "fd8d3c",
    "Position": 0.5
  },
  {
    "Colour": "e31a1c",
    "Position": 1.0
  }
]

This example results in the following interpolated gradient:

Yellow/red gradient

Resources

  • Color Brewer is a great source for sample map gradients.
  • Colorpicker for data is another excellent resource for creating custom gradients in the CIE colour space.