Skip to content

Export Formats Overview

Palettize supports exporting colormaps to 14 different formats for GIS applications, web mapping, and data visualization.

IdentifierNameExtensionUse Case
gdalGDAL Color Relief.txtGDAL gdaldem color-relief
qgisQGIS Color Ramp XML.xmlQGIS styles and projects
sldOGC SLD XML.sldGeoServer, WMS services
titilerTiTiler Colormap URL.txtTiTiler tile server
mapglMapLibre GL JS.jsonMapLibre/Mapbox web maps
observableObservable Plot.jsonObservable notebooks
geeGoogle Earth Engine.jsGEE Code Editor
hexPlaintext Hex.txtGeneral purpose
rgbaPlaintext RGBA.txtCSS/web development
hslPlaintext HSL.txtCSS/web development
jsonJSON.jsonJavaScript apps, config files
cssCSS Custom Properties.cssWeb design systems
gimpGIMP Palette.gplGIMP, Inkscape, Krita
svgSVG Gradient.svgWeb graphics, design tools
Terminal window
# Run with uvx (no installation required)
uvx palettize create viridis --format gdal --output viridis.txt --domain 0,255
# Or if installed
palettize create viridis --format gdal --output viridis.txt --domain 0,255
# Multiple formats
palettize create viridis --format gdal,qgis,mapgl \
--output "{name}_{format}.{ext}" --domain 0,255
from palettize import create_colormap, get_scaler_by_name, get_exporter
cmap = create_colormap(preset="viridis")
scaler = get_scaler_by_name("linear", domain_min=0, domain_max=255)
exporter = get_exporter("gdal")
output = exporter.export(
colormap=cmap,
scaler=scaler,
domain_min=0,
domain_max=255,
options={"num_colors": 256}
)
  • GDAL: For raster processing with GDAL command-line tools
  • QGIS: For QGIS desktop GIS styling
  • SLD: For OGC-compliant web services (GeoServer, WMS)
  • TiTiler: For dynamic tile server colorization
  • MapLibre GL JS: For browser-based vector/raster maps
  • Observable Plot: For Observable notebooks and D3 visualizations
  • Google Earth Engine: For GEE Code Editor scripts
  • JSON: Flexible JSON arrays/objects for JavaScript applications
  • CSS: CSS custom properties for design systems
  • SVG: SVG gradient elements for web graphics
  • GIMP: GIMP Palette format (.gpl) for graphics applications
  • Hex: Simple hex color lists for any application
  • RGBA: CSS-compatible RGBA values
  • HSL: CSS-compatible HSL values

num_colors is accepted by almost every format. precision is read by gdal and mapgl only. Unknown -O keys produce a warning and are otherwise ignored. Run palettize formats <name> for the options a format actually declares.

OptionTypeDefaultDescription
num_colorsintvariesNumber of color steps
precisionint(unset)Decimal places for data values (gdal, mapgl)
namestrColormap name for output metadata

Use the -O or --option flag:

Terminal window
# Global option (applies to all formats)
palettize create viridis -f gdal -O num_colors=256
# Format-specific option
palettize create viridis -f gdal,qgis -O gdal:num_colors=256 -O qgis:ramp_type=exact

Pass a dictionary to the options parameter:

output = exporter.export(
colormap=cmap,
scaler=scaler,
domain_min=0,
domain_max=255,
options={
"num_colors": 256,
"name": "My Colormap"
}
)
If you need to…Use
Apply colors to rasters with GDALgdal
Style layers in QGISqgis
Publish to GeoServer or WMSsld
Colorize COGs with TiTilertitiler
Style web maps with MapLibremapgl
Create D3/Observable visualizationsobservable
Analyze satellite data in GEEgee
Just need a list of colorshex, rgba, or hsl
Use colors in JavaScript/config filesjson
Create CSS design system variablescss
Use colors in GIMP/Inkscape/Kritagimp
Create web graphics with gradientssvg