Skip to main content

ImageEffectShadow

ClassDataClassSource

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

The image effect: Shadow

Add the shadow 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 shadow.
typeLiteral["shadow"]The type code of this effect. It should not be modified.
sizeintThe size of the shadow. This size can be viewed as "brush size" when creating the shadow.
offsetintThe offset of the shadow. It represents the distance between the shadow and the image.
colorstr | tuple[float, ...]The RGB/RGBA color of the shadow.

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.