---
name: "pct2rgb"
section: "1"
platform: "linux"
package: "gdal"
version: "3.13.3-6"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/pct2rgb"
---

# pct2rgb(1)

Convert an 8bit paletted image to 24bit RGB.

## NAME

pct2rgb - Convert an 8bit paletted image to 24bit RGB.

## SYNOPSIS

```
pct2rgb [--help] [--help-general]
           [-of format] [-b band] [-rgba] [-pct palette_file] <source_file> <dest_file>
```

## DESCRIPTION

This utility will convert a pseudo-color band on the input file into an output RGB file of the desired format.

**NOTE:**

pct2rgb is a Python utility, and is only available if GDAL Python bindings are available.

- **--help**

  Show this help message and exit

- **--help-general**

  Gives a brief usage message for the generic GDAL commandline options and exit.

- **-of \<format\>**

  Select the output format. If not specified, the format is guessed from the extension. Use the short format name.

- **-b \<band\>**

  Band to convert to RGB, defaults to 1.

- **-rgba**

  Generate a RGBA file (instead of a RGB file by default).

- **-pct \<palette\_file\>**

  Extract the color table from \<palette\_file\> instead of getting it from \<source\_file\>. Can be used to have a consistent color table for multiple files. The \<palette\_file\> must 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.

- **\<dest\_file\>**

  The output RGB file that will be created.

The '-expand rgb\|rgba' option of *gdal\_translate* obsoletes that utility.

## 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 successful execution).

## AUTHOR

Frank Warmerdam \<warmerdam@pobox.com\>, Silke Reimer \<silke@intevation.de\>

## COPYRIGHT

1998-2026
