palettize create
The create command exports colormaps to one or more file formats for use in GIS applications, web mapping, and data visualization.
palettize create [PRESET_NAME] [OPTIONS]Pass --format to export, --save to store the colormap, or both. A run with neither exits as a usage error.
Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
PRESET_NAME | Preset name (e.g. viridis) or path to a saved colormap JSON file. Optional if --colors is provided. |
Colormap Options
Section titled “Colormap Options”| Option | Short | Default | Description |
|---|---|---|---|
--colors | -c | List of input colors to create a colormap from. | |
--space | -s | oklch | Color space for interpolation. |
--cut | 0,1 | Sub-segment of the colormap to use (e.g., 0.2,0.8). | |
--reverse | -r | Reverse the colormap before exporting. | |
--name | Name for the colormap, used in file naming and output. | ||
--save | Write the colormap to this JSON path. Works without --format. |
Output Options
Section titled “Output Options”| Option | Short | Default | Description |
|---|---|---|---|
--format | -f | Export format identifiers. Use multiple times or comma-separate. Required unless you only --save. | |
--output | -o | stdout | Output path pattern. Supports {name}, {format}, {ext} placeholders. |
--steps | -n | 7 | Number of color steps. Minimum: 2. Also sets num_colors when that option is unset. |
--precision | Decimal places for data values. Read by gdal and mapgl. |
Data Domain and Scaling
Section titled “Data Domain and Scaling”| Option | Short | Default | Description |
|---|---|---|---|
--domain | -d | 0,1 | Data domain for scaling (e.g., 0,100 or -10,10). |
--scale | linear | Scaling type: linear, power, sqrt, log, symlog. | |
--scale-exponent | Exponent for power scale. Required when --scale=power. | ||
--scale-log-base | 10 | Log base for log or symlog scales. | |
--scale-symlog-linthresh | Linear threshold for symlog scale. Required when --scale=symlog. |
--scale moves colors for gdal, mapgl, and for qgis / sld when they emit a gradient or ramp. Discrete QGIS ramps (exact, approximate) and discrete SLD maps (intervals, values) keep the colormap’s own stops. Other formats either ignore the scaler or record the scale name for the application to apply. palettize formats marks which formats use the domain and the scaler.
Format-Specific Options
Section titled “Format-Specific Options”| Option | Short | Description |
|---|---|---|
--option | -O | Pass format-specific options as key=value or exporter:key=value. Use multiple times. |
Examples
Section titled “Examples”Basic Export
Section titled “Basic Export”# Export viridis to GDAL formatpalettize create viridis --format gdal --output viridis.txt
# Export with custom data domainpalettize create viridis -f gdal -o viridis.txt --domain 0,255Export Custom Colors
Section titled “Export Custom Colors”# Create a blue-white-red diverging colormappalettize create --colors "blue,white,red" -f gdal -o bwr.txt --domain -100,100Multiple Formats
Section titled “Multiple Formats”Use the {name}, {format}, and {ext} placeholders in the output path:
palettize create viridis --format gdal,qgis,mapgl \ --output "output/{name}_{format}.{ext}" \ --domain 0,255 \ --steps 11This creates:
output/viridis_gdal.txtoutput/viridis_qgis.xmloutput/viridis_mapgl.json
Control Number of Colors
Section titled “Control Number of Colors”# Generate 256 discrete colorspalettize create viridis -f gdal -o viridis.txt --steps 256
# Generate only 5 colorspalettize create viridis -f hex -n 5Data Scaling
Section titled “Data Scaling”Linear (Default)
Section titled “Linear (Default)”palettize create viridis -f gdal -o output.txt --domain 0,100 --scale linearSquare Root
Section titled “Square Root”palettize create viridis -f gdal -o output.txt --domain 0,100 --scale sqrt# Quadratic scaling (exponent=2)palettize create viridis -f gdal -o output.txt --domain 0,100 --scale power --scale-exponent 2Logarithmic
Section titled “Logarithmic”# Log base 10palettize create viridis -f gdal -o output.txt --domain 1,1000 --scale log
# Log base 2palettize create viridis -f gdal -o output.txt --domain 1,1024 --scale log --scale-log-base 2Symmetric Log (for data spanning zero)
Section titled “Symmetric Log (for data spanning zero)”palettize create --colors "blue,white,red" -f gdal -o output.txt \ --domain -100,100 --scale symlog --scale-symlog-linthresh 1Format-Specific Options
Section titled “Format-Specific Options”Use -O or --option to pass options to specific exporters:
# Set Observable Plot scale typepalettize create RdBu -f observable -o plot.json \ --domain -5,10 -O type=diverging -O pivot=0
# Target a specific exporterpalettize create viridis -f gdal,qgis \ -O gdal:nodata_value=0 -O qgis:ramp_type=exactPrint to Standard Output
Section titled “Print to Standard Output”Omit --output to print the result:
# Print hex colorspalettize create viridis -f hex -n 5Output:
#440154#3b528b#21918d#5cc863#fde725Verbose Output
Section titled “Verbose Output”palettize -v create viridis -f gdal -o viridis.txt --domain 0,255Output:
Exporting to gdal...Wrote viridis.txtExport complete.Save without Exporting
Section titled “Save without Exporting”palettize create viridis --cut 0.2,0.8 --reverse --save my-map.jsonAvailable Formats
Section titled “Available Formats”Run palettize formats for the live list, including each format’s options:
| Identifier | Description |
|---|---|
gdal | GDAL Color Relief Text |
qgis | QGIS Color Ramp XML |
sld | OGC SLD XML |
titiler | TiTiler Colormap URL Parameter |
mapgl | MapLibre GL JS Expression |
observable | Observable Plot Scale |
gee | Google Earth Engine Snippet |
css | CSS Custom Properties |
svg | SVG Gradient |
gimp | GIMP Palette |
json | JSON |
hex | Plaintext Hexadecimal |
rgba | Plaintext RGBA |
hsl | Plaintext HSL |
See Export Formats for detailed documentation of each format.