Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

RGB2PCT

Convert RGB three band to single band colour table


Description

This function converts a three-band GDALReadOnlyDataset into a single band of colour indices as a GDALTransientDataset.

Usage

RGB2PCT(x, band, driver.name = 'MEM', ncolors = 256, set.ctab = TRUE)

Arguments

x

a three-band GDALReadOnlyDataset object

band

a vector of numbers, recycled up to 3 in length

driver.name

default MEM

ncolors

a number of colours between 2 and 256

set.ctab

default TRUE, when the dithered dataset handle is returned, otherwise a list of the dataset and the PCT colour table

Value

The value returned is a either GDALTransientDataset or a list of a GDALTransientDataset and a colour table.

Author(s)

Tim Keitt

References

Examples

## Not run: 
logo <- system.file("pictures/Rlogo.jpg", package="rgdal")[1]
x <- GDAL.open(logo)
dim(x)
dx <- RGB2PCT(x, band=1:3)
displayDataset(dx, reset.par=FALSE)
dim(dx)
GDAL.close(x)
GDAL.close(dx)

## End(Not run)

rgdal

Bindings for the 'Geospatial' Data Abstraction Library

v1.5-23
GPL (>= 2)
Authors
Roger Bivand [cre, aut] (<https://orcid.org/0000-0003-2392-6140>), Tim Keitt [aut], Barry Rowlingson [aut, ctb], Edzer Pebesma [ctb], Michael Sumner [ctb], Robert Hijmans [ctb], Daniel Baston [ctb], Even Rouault [cph, ctb], Frank Warmerdam [cph, ctb], Jeroen Ooms [ctb], Colin Rundel [ctb]
Initial release
2021-02-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.