FreeBSD Manual Pages
GDAL-RASTER-RGB-TO-PALETTE(1) GDAL GDAL-RASTER-RGB-TO-PALETTE(1) NAME gdal-raster-rgb-to-palette - Convert a RGB image into a pseudo-color / paletted image. Added in version 3.12. SYNOPSIS Usage: gdal raster rgb-to-palette [OPTIONS] <INPUT> <OUTPUT> Convert a RGB image into a pseudo-color / paletted image. Positional arguments: -i, --input <INPUT> Input raster datasets [required] [not available in pipelines] -o, --output <OUTPUT> Output raster dataset [required] [not available in pipelines] Common Options: -h, --help Display help message and exit --json-usage Display usage as JSON document and exit --config <KEY>=<VALUE> Configuration option [may be repeated] -q, --quiet Quiet mode (no progress bar or warning message) [not available in pipelines] Options: -f, --of, --format, --output-format <OUTPUT-FORMAT> Output format ("GDALG" allowed) [not available in pipelines] --co, --creation-option <KEY>=<VALUE> Creation option [may be repeated] [not available in pipelines] --overwrite Whether overwriting existing output dataset is allowed [not available in pipelines] Mutually exclusive with --append --append Append as a subdataset to existing output [not available in pipelines] Mutually exclusive with --overwrite --color-count <COLOR-COUNT> Select the number of colors in the generated color table (default: 256) --color-map <COLOR-MAP> Color map filename --output-nodata <OUTPUT-NODATA> Output nodata value --no-dither Disable Floyd-Steinberg dithering --bit-depth <BIT-DEPTH> Bit depth of color palette component (8 bit causes longer computation time). BIT-DEPTH=5|8 (default: 5) Advanced Options: --if, --input-format <INPUT-FORMAT> Input formats [may be repeated] [not available in pipelines] --oo, --open-option <KEY>=<VALUE> Open options [may be repeated] [not available in pipelines] DESCRIPTION gdal raster rgb-to-palette computes an optimal pseudo-color table for a given RGB image using a median cut algorithm on a downsampled RGB his- togram, unless a color table is provided with the --color-map option. Then it converts the image into a pseudo-colored image using the color table. This conversion utilizes by default Floyd-Steinberg dithering (error diffu- sion) to maximize output image visual quality. This subcommand is also available as a potential step of gdal raster pipeline GDALG OUTPUT (ON-THE-FLY / STREAMED DATASET) This program supports serializing the command line as a JSON file using the GDALG output format. The resulting file can then be opened as a raster dataset using the GDALG: GDAL Streamed Algorithm driver, and apply the specified pipeline in a on-the-fly / streamed way. NOTE: However this algorithm is not natively streaming compatible. Conse- quently a temporary dataset will be generated, which may cause signifi- cant processing time at opening. PROGRAM-SPECIFIC OPTIONS --color-count <COLOR-COUNT> Select the number of colors in the generated color table. Defaults to 256. Must be between 2 and 256. --color-map <FILENAME> Extract the color table from <FILENAME> instead of computing it. Can be used to have a consistent color table for multiple files. The <FILENAME> must be either a raster file in a GDAL supported for- mat with a palette or a color file in a supported format (.txt, QGIS .qml, QGIS .qlr). --output-nodata <VALUE> Added in version 3.13. Specifies the output nodata value, that will be used for input pix- els at the source nodata value or that are transparent due to a mask band, such as an alpha band. The destination nodata value must be between 0 and 255. If there is a source nodata value or a dataset-wide mask band is attached to the source bands, and --output-nodata is not specified, it defaults to 0. --no-dither Added in version 3.13. Disable Floyd-Steinberg dithering (error diffusion). This may be useful to improve the compression rate by avoiding the "noise" added by error diffusion. --bit-depth 5|8 Added in version 3.13. Bit depth of each of the output color table R, G, B component. The default value is 5, which means that each of the component is lim- ited to 32 = 2 ^ 5 values. Setting bit depth to 8 increases the fi- delity of the output color table at the expense of longer computa- tion time. STANDARD OPTIONS --co, --creation-option <NAME>=<VALUE> Many formats have one or more optional creation options that can be used to control particulars about the file created. For instance, the GeoTIFF driver supports creation options to control compression, and whether the file should be tiled. May be repeated. The creation options available vary by format driver, and some sim- ple formats have no creation options at all. A list of options sup- ported for a format can be listed with the --formats command line option but the documentation for the format is the definitive source of information on driver creation options. See Raster drivers for- mat specific documentation for legal creation options for each for- mat. -f, --of, --format, --output-format <OUTPUT-FORMAT> Which output raster format to use. Allowed values may be given by gdal --formats | grep raster | grep rw | sort --overwrite Allow program to overwrite existing target file or dataset. Other- wise, by default, gdal errors out if the target file or dataset al- ready exists. RETURN STATUS CODE The program returns status code 0 in case of success, and non-zero in case of error (non-blocking errors emitted as warnings are considered as a suc- cessful execution). EXAMPLES Example 1 Convert a TIFF file into a paletted PNG image $ gdal raster rgb-to-palette input.tif output.png AUTHOR Even Rouault <even.rouault@spatialys.com> COPYRIGHT 1998-2026 Jun 05, 2026 GDAL-RASTER-RGB-TO-PALETTE(1)
NAME | SYNOPSIS | DESCRIPTION | GDALG OUTPUT (ON-THE-FLY / STREAMED DATASET) | PROGRAM-SPECIFIC OPTIONS | STANDARD OPTIONS | RETURN STATUS CODE | EXAMPLES | AUTHOR | COPYRIGHT
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=gdal-raster-rgb-to-palette&sektion=1&manpath=FreeBSD+Ports+15.1.quarterly>
