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.
  • -of format β€” 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.
  • -b band β€” which band to convert to RGB. defaults to 1. 🎯
  • -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.
  • -pct palette_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 0 when 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>


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