Class: QgsColorEffect

A paint effect which alters the colors (e.g., brightness, contrast) in a source picture.

Class Hierarchy

Inheritance diagram of qgis.core.QgsColorEffect

Base classes

QgsPaintEffect

Base class for visual effects which can be applied to QPicture drawings.

class qgis.core.QgsColorEffect[source]

Bases: QgsPaintEffect

blendMode(self) QPainter.CompositionMode[source]

Returns the blend mode for the effect

Return type:

QPainter.CompositionMode

Returns:

blend mode used for drawing the effect on to a destination paint device

See also

setBlendMode()

brightness(self) int[source]

Returns the brightness modification for the effect.

Return type:

int

Returns:

brightness value. Values are between -255 and 255, where 0 represents no change, negative values indicate darkening and positive values indicate lightening

See also

setBrightness()

colorizeColor(self) QColor[source]

Returns the color used for colorizing a picture. This is only used if colorizeOn() is set to True.

Return type:

QColor

Returns:

colorization color

See also

colorizeOn()

colorizeOn(self) bool[source]

Returns whether the effect will colorize a picture.

Return type:

bool

Returns:

True if colorization is enabled

See also

setColorizeOn()

See also

colorizeColor()

colorizeStrength(self) int[source]

Returns the strength used for colorizing a picture. This is only used if setColorizeOn() is set to True.

Return type:

int

Returns:

colorization strength, between 0 and 100

See also

colorizeOn()

See also

colorizeColor()

contrast(self) int[source]

Returns the contrast modification for the effect.

Return type:

int

Returns:

contrast value. Values are between -100 and 100, where 0 represents no change, negative values indicate less contrast and positive values indicate greater contrast

See also

setContrast()

static create(map: Dict[str, Any]) QgsPaintEffect | None[source]

Creates a new QgsColorEffect effect from a properties string map.

Parameters:

map (Dict[str, Any]) – encoded properties string map

Return type:

Optional[QgsPaintEffect]

Returns:

new QgsColorEffect

grayscaleMode(self) QgsImageOperation.GrayscaleMode[source]

Returns whether the effect will convert a picture to grayscale.

Return type:

QgsImageOperation.GrayscaleMode

Returns:

method for grayscale conversion

opacity(self) float[source]

Returns the opacity for the effect.

Return type:

float

Returns:

opacity value between 0 and 1 inclusive, where 0 is fully transparent and 1 is fully opaque.

See also

setOpacity()

saturation(self) float[source]

Returns the saturation modification for the effect.

Return type:

float

Returns:

saturation value. Values are between 0 and 2.0, where 1.0 represents no change, 0.0 represents totally desaturated (grayscale), and positive values indicate greater saturation

See also

setSaturation()

setBlendMode(self, mode: QPainter.CompositionMode)[source]

Sets the blend mode for the effect

Parameters:

mode (QPainter.CompositionMode) – blend mode used for drawing the effect on to a destination paint device

See also

blendMode()

setBrightness(self, brightness: int)[source]

Sets the brightness modification for the effect.

Parameters:

brightness (int) – Valid values are between -255 and 255, where 0 represents no change, negative values indicate darkening and positive values indicate lightening

See also

setBrightness()

setColorizeColor(self, colorizeColor: QColor | Qt.GlobalColor)[source]

Sets the color used for colorizing a picture. This is only used if setColorizeOn() is set to True.

Parameters:

colorizeColor (Union[QColor, Qt.GlobalColor]) – colorization color

See also

colorizeColor()

See also

setColorizeOn()

setColorizeOn(self, colorizeOn: bool)[source]

Sets whether the effect should colorize a picture.

Parameters:

colorizeOn (bool) – set to True to enable colorization

See also

colorizeOn()

setColorizeStrength(self, colorizeStrength: int)[source]

Sets the strength for colorizing a picture. This is only used if setColorizeOn() is set to True.

Parameters:

colorizeStrength (int) – colorization strength, between 0 and 100

See also

setColorizeOn()

setContrast(self, contrast: int)[source]

Sets the contrast modification for the effect.

Parameters:

contrast (int) – Valid values are between -100 and 100, where 0 represents no change, negative values indicate less contrast and positive values indicate greater contrast

See also

setContrast()

setGrayscaleMode(self, grayscaleMode: QgsImageOperation.GrayscaleMode)[source]

Sets whether the effect should convert a picture to grayscale.

Parameters:

grayscaleMode (QgsImageOperation.GrayscaleMode) – method for grayscale conversion

See also

grayscaleMode()

setOpacity(self, opacity: float)[source]

Sets the opacity for the effect.

Parameters:

opacity (float) – double between 0 and 1 inclusive, where 0 is fully transparent and 1 is fully opaque

See also

opacity()

setSaturation(self, saturation: float)[source]

Sets the saturation modification for the effect.

Parameters:

saturation (float) – Valid values are between 0 and 2.0, where 1.0 represents no change, 0.0 represents totally desaturated (grayscale), and positive values indicate greater saturation

See also

saturation()