- Main Page
- Classes
- Files
- Directories
- Related Pages

# rgb2pct.py

converts an image into a pseudo-colored image

Usage:

    rgb2pct.py [-n colors] [-of format] source_file dest_file

This utility will compute an optimal pseudo-color table for a given RGB image using a median cut algorithm on a downsampled RGB histogram. Then it converts the image into a pseudo-colored image using the color table. This conversion utilizes Floyd-Steinberg dithering (error diffusion) to maximize output image visual quality.

-n colors:
  Select the number of colors in the generated color table. Defaults to 256. Must be between 2 and 256.
-of format:
  Format to generated (defaults to GeoTIFF). Same semantics as the -of flag for gdal_translate. Only output formats supporting pseudocolor tables should be used.
source_file:
  The input RGB file.
dest_file:
  The output pseudo-colored file that will be created.

NOTE: rgb2pct.py is a Python script, and will only work if GDAL was built with Python support.

Generated for GDAL by 1.4.5.