Skip to content

palettize create

The create command exports colormaps to one or more file formats for use in GIS applications, web mapping, and data visualization.

Terminal window
palettize create [PRESET_NAME] --format FORMAT [OPTIONS]
ArgumentDescription
PRESET_NAMEName of a preset palette (e.g., viridis). Optional if --colors is provided.
OptionShortDescription
--format-fOne or more export format identifiers. Use multiple times or comma-separate.
OptionShortDefaultDescription
--colors-cList of input colors to create a colormap from.
--space-soklchColor space for interpolation.
--cut0,1Sub-segment of the colormap to use (e.g., 0.2,0.8).
--nameName for the colormap, used in file naming and output.
OptionShortDefaultDescription
--output-ostdoutOutput path pattern. Supports {name}, {format}, {ext} placeholders.
--steps-n7Number of discrete color steps for outputs. Minimum: 2.
--precisionDecimal places for numeric values in output.
OptionShortDefaultDescription
--domain-d0,1Data domain for scaling (e.g., 0,100 or -10,10).
--scalelinearScaling type: linear, power, sqrt, log, symlog.
--scale-exponentExponent for power scale. Required when --scale=power.
--scale-log-base10Log base for log or symlog scales.
--scale-symlog-linthreshLinear threshold for symlog scale. Required when --scale=symlog.
OptionShortDescription
--option-OPass format-specific options as key=value or exporter:key=value. Use multiple times.
Terminal window
# Export viridis to GDAL format
palettize create viridis --format gdal --output viridis.txt
# Export with custom data domain
palettize create viridis -f gdal -o viridis.txt --domain 0,255
Terminal window
# Create a blue-white-red diverging colormap
palettize create --colors "blue,white,red" -f gdal -o bwr.txt --domain -100,100

Use the {name}, {format}, and {ext} placeholders in the output path:

Terminal window
palettize create viridis --format gdal,qgis,mapgl \
--output "output/{name}_{format}.{ext}" \
--domain 0,255 \
--steps 11

This creates:

  • output/viridis_gdal.txt
  • output/viridis_qgis.xml
  • output/viridis_mapgl.json
Terminal window
# Generate 256 discrete colors
palettize create viridis -f gdal -o viridis.txt --steps 256
# Generate only 5 colors
palettize create viridis -f hex -n 5
Terminal window
palettize create viridis -f gdal -o output.txt --domain 0,100 --scale linear
Terminal window
palettize create viridis -f gdal -o output.txt --domain 0,100 --scale sqrt
Terminal window
# Quadratic scaling (exponent=2)
palettize create viridis -f gdal -o output.txt --domain 0,100 --scale power --scale-exponent 2
Terminal window
# Log base 10
palettize create viridis -f gdal -o output.txt --domain 1,1000 --scale log
# Log base 2
palettize create viridis -f gdal -o output.txt --domain 1,1024 --scale log --scale-log-base 2
Terminal window
palettize create --colors "blue,white,red" -f gdal -o output.txt \
--domain -100,100 --scale symlog --scale-symlog-linthresh 1

Use -O or --option to pass options to specific exporters:

Terminal window
# Set Observable Plot scale type
palettize create RdBu -f observable -o plot.json \
--domain -5,10 -O type=diverging -O pivot=0
# Target a specific exporter
palettize create viridis -f gdal,qgis \
-O gdal:nodata_value=0 -O qgis:ramp_type=exact

Omit --output to print the result:

Terminal window
# Print hex colors
palettize create viridis -f hex -n 5

Output:

#440154
#3b528b
#21918c
#5ec962
#fde725
Terminal window
palettize -v create viridis -f gdal -o viridis.txt --domain 0,255

Output:

Exporting to gdal format...
Successfully wrote to viridis.txt
Export process completed.

Run palettize list exporters to see all available formats:

IdentifierDescription
gdalGDAL Color Relief Text
qgisQGIS Color Ramp XML
sldOGC SLD XML
titilerTiTiler Colormap URL Parameter
mapglMapLibre GL JS Expression
observableObservable Plot Scale
geeGoogle Earth Engine Snippet
hexPlaintext Hexadecimal
rgbaPlaintext RGBA

See Export Formats for detailed documentation of each format.