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] --format FORMAT [OPTIONS]Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
PRESET_NAME | Name of a preset palette (e.g., viridis). Optional if --colors is provided. |
Required Options
Section titled “Required Options”| Option | Short | Description |
|---|---|---|
--format | -f | One or more export format identifiers. Use multiple times or comma-separate. |
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). | |
--name | Name for the colormap, used in file naming and output. |
Output Options
Section titled “Output Options”| Option | Short | Default | Description |
|---|---|---|---|
--output | -o | stdout | Output path pattern. Supports {name}, {format}, {ext} placeholders. |
--steps | -n | 7 | Number of discrete color steps for outputs. Minimum: 2. |
--precision | Decimal places for numeric values in output. |
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. |
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#21918c#5ec962#fde725Verbose Output
Section titled “Verbose Output”palettize -v create viridis -f gdal -o viridis.txt --domain 0,255Output:
Exporting to gdal format...Successfully wrote to viridis.txtExport process completed.Available Formats
Section titled “Available Formats”Run palettize list exporters to see all available formats:
| 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 |
hex | Plaintext Hexadecimal |
rgba | Plaintext RGBA |
See Export Formats for detailed documentation of each format.