Skip to main content

ImageEffectStroke

ClassDataClassSource

ImageEffectStroke(
mode: Literal["default", "add", "add_modulo", "screen", "lighter", "subtract", "subtract_modulo", "multiply", "darker", "difference", "soft_light", "hard_light"] = "default",
type: Literal["stroke"] = "stroke",
size: int = 2,
color: str | tuple[float, ...] = "#000000"
)

The image effect: Stroke

Add the stroke effect to the alpha channel of the given image.

Fields​

NameTypeRequired
Description
modeLiteral["default", "add", "add_modulo", "screen", "lighter", "subtract", "subtract_modulo", "multiply", "darker", "difference", "soft_light", "hard_light"]The blending mode of the stroke.
typeLiteral["stroke"]The type code of this effect. It should not be modified.
sizeintThe size of the stroke.
colorstr | tuple[float, ...]The RGB/RGBA color of the stroke.

Methods​

effect​

v_1: Image | None = self.effect(image_fg: Image)

Generate the effect image from the given image.

Requires​

NameTypeRequired
Description
image_fgImageThe image used for genereating this effect.

Returns​

NameType
Description
v_1Image | None

The generated effect image. This image should be RGBA, and the size can be different from the input image.

This image should be center-aligned with the input image_fg.

Will return None if the effect should be skipped.