Class: QgsBrightnessContrastFilter

class qgis.core.QgsBrightnessContrastFilter

Bases: QgsRasterInterface

Brightness/contrast and gamma correction filter pipe for rasters.

Methods

bandCount

Gets number of bands

block

Read block of data using given extent and size.

brightness

Returns current brightness level.

clone

Clone itself, create deep copy

contrast

Returns current contrast level.

dataType

Returns data type for the band specified by number

gamma

Returns current gamma value.

initHistogram

Fill in histogram defaults if not specified

initStatistics

Fill in statistics defaults if not specified

readXml

Sets base class members from xml.

setBrightness

Set brightness level.

setContrast

Set contrast level.

setGamma

Set gamma value.

setInput

Set input.

writeXml

Write base class members to xml.

bandCount(self) int

Gets number of bands

Return type:

int

block(self, bandNo: int, extent: QgsRectangle, width: int, height: int, feedback: QgsRasterBlockFeedback = None) QgsRasterBlock

Read block of data using given extent and size. Returns pointer to data. Caller is responsible to free the memory returned.

Parameters:
  • bandNo (int) – band number

  • extent (QgsRectangle) – extent of block

  • width (int) – pixel width of block

  • height (int) – pixel height of block

  • feedback (QgsRasterBlockFeedback = None) – optional raster feedback object for cancellation/preview. Added in QGIS 3.0.

Return type:

QgsRasterBlock

brightness(self) int

Returns current brightness level.

See also

setBrightness()

Return type:

int

clone(self) QgsBrightnessContrastFilter

Clone itself, create deep copy

Return type:

QgsBrightnessContrastFilter

contrast(self) int

Returns current contrast level.

See also

setContrast()

Return type:

int

dataType(self, bandNo: int) Qgis.DataType

Returns data type for the band specified by number

Parameters:

bandNo (int) –

Return type:

Qgis.DataType

gamma(self) float

Returns current gamma value.

See also

setGamma()

New in version 3.16.

Return type:

float

initHistogram(self, histogram: QgsRasterHistogram, bandNo: int, binCount: int, minimum: object = Py_None, maximum: object = Py_None, boundingBox: QgsRectangle = QgsRectangle(), sampleSize: int = 0, includeOutOfRange: bool = False)

Fill in histogram defaults if not specified

Note

the parameters are the same as in histogram()

initStatistics(self, statistics: QgsRasterBandStats, bandNo: int, stats: int = QgsRasterBandStats.All, boundingBox: QgsRectangle = QgsRectangle(), binCount: int = 0)

Fill in statistics defaults if not specified

readXml(self, filterElem: QDomElement)

Sets base class members from xml. Usually called from create() methods of subclasses

Parameters:

filterElem (QDomElement) –

setBrightness(self, brightness: int)

Set brightness level. Acceptable value range is -255…255

See also

brightness()

Parameters:

brightness (int) –

setContrast(self, contrast: int)

Set contrast level. Acceptable value range is -100…100

See also

contrast()

Parameters:

contrast (int) –

setGamma(self, gamma: float)

Set gamma value. Acceptable value range is -0.1…10

See also

gamma()

New in version 3.16.

Parameters:

gamma (float) –

setInput(self, input: QgsRasterInterface) bool

Set input. Returns True if set correctly, False if cannot use that input

Parameters:

input (QgsRasterInterface) –

Return type:

bool

writeXml(self, doc: QDomDocument, parentElem: QDomElement)

Write base class members to xml.

Parameters:
  • doc (QDomDocument) –

  • parentElem (QDomElement) –