PCT2RGB(1)
π PCT2RGB(1) π
okay bestie, welcome to the GDAL manual, section 1, and today's main character is pct2rgb β she's a whole Python girlie and she's about to glow up your palette. let's get into it. π¦
β¨ NAME β¨
pct2rgb β the tool that takes an 8-bit paletted image and turns it into a 24-bit RGB baddie. π
πΈ SYNOPSIS πΈ
pct2rgb [--help] [--help-general]
[-of format] [-b band] [-rgba] [-pct palette_file] <source_file> <dest_file>
π DESCRIPTION π
so basically: this utility converts a pseudo-color band on the input file into an output RGB file, in whatever format you're feeling. periodt. β¨
NOTE: bestie listen β pct2rgb is a Python utility, and she only shows up if the GDAL Python bindings are available. no bindings, no girlie. π
--helpβ shows you this help message and then dips. bye! π--help-generalβ gives you a lil brief usage message for the generic GDAL commandline options, then exits.-offormat β picks the output format. if you don't say anything, the format gets guessed from the extension. use the short format name, okay? don't be extra.-bband β which band to convert to RGB. defaults to1. π―-rgbaβ generate an RGBA file instead of the plain RGB file you get by default. she's got the extra alpha channel now, main character energy fr fr.-pctpalette_file β extract the color table from palette_file instead of grabbing it from source_file. this one is iconic for keeping a consistent color table across multiple files, iykyk. the palette_file has to be either a raster file in a GDAL supported format with a palette, or a color file in a supported format (txt,qml,qlr). π¨- source_file β the input file. the starter. the before. π
- dest_file β the output RGB file that will get created. the glow-up. the after. π
also just so you know: the -expand rgb|rgba option of gdal_translate obsoletes that utility. so like... she's still serving, but there's a newer option on the block. π
π RETURN STATUS CODE π
- returns status code
0when it's a success, slay. π - returns non-zero when there's an error. but lowkey β non-blocking errors that get emitted as warnings are still considered a successful execution. so a little warning never hurt nobody. π«Ά
π AUTHOR π
Frank Warmerdam <warmerdam@pobox.com>, Silke Reimer <silke@intevation.de>
β COPYRIGHT β
1998-2026
and that's the whole page bestie, you ate that. π the source sits at GDAL and this version of the page is dated Aug 18, 2026 β go convert something pretty, mwah ππ§
π¦ where this page comes from
- alpine 3.24: gdal-doc 3.13.3-r0 Β· MIT
- arch rolling: gdal 3.13.3-6 Β· MIT
- ubuntu stonking: gdal-bin 3.13.3+dfsg-1ubuntu4 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms