<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>GDAL: rgb2pct.py</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.2-20100208 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li class="current"><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> </div> <div class="contents"> <h1><a class="anchor" id="rgb2pct">rgb2pct.py </a></h1><p>Convert a 24bit RGB image to 8bit paletted</p> <h2><a class="anchor" id="rsynopsis"> SYNOPSIS</a></h2> <div class="fragment"><pre class="fragment"> rgb2pct.py [-n colors] [-of format] source_file dest_file </pre></div><h2><a class="anchor" id="rdescription"> DESCRIPTION</a></h2> <p>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.</p> <dl> <dt><b>-n</b> <em>colors</em>:</dt> <dd>Select the number of colors in the generated color table. Defaults to 256. Must be between 2 and 256. </dd> <dt><b>-of</b> <em>format</em>:</dt> <dd>Format to generated (defaults to GeoTIFF). Same semantics as the <b>-of</b> flag for gdal_translate. Only output formats supporting pseudocolor tables should be used. </dd> <dt><em>source_file</em>:</dt> <dd>The input RGB file. </dd> <dt><em>dest_file</em>:</dt> <dd>The output pseudo-colored file that will be created. </dd> </dl> <p>NOTE: rgb2pct.py is a Python script, and will only work if GDAL was built with Python support. </p> </div> <hr> Generated for GDAL by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.6.2-20100208. </body> </html>