Working with 3D Effects and Visual Effects — Aspose.Slides FOSS for Python

This guide shows how to apply visual effects and 3D formatting to shapes in PowerPoint presentations using Aspose.Slides FOSS for Python. Every shape exposes two formatting objects:

  • EffectFormat (shape.effect_format): 2D visual effects — shadow, glow, soft edge, blur, reflection
  • ThreeDFormat (shape.three_d_format): 3D appearance — bevel, camera projection, light rig, material, extrusion depth

Both formatting objects persist through save/reload cycles.


Visual Effects (EffectFormat)

Outer Drop Shadow

Call ef.enable_outer_shadow_effect() to activate the outer shadow, then set blur_radius, direction, distance, and shadow_color:

from aspose.slides_foss import ShapeType
from aspose.slides_foss.drawing import Color
import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    shape = prs.slides[0].shapes.add_auto_shape(ShapeType.RECTANGLE, 100, 100, 300, 120)
    shape.add_text_frame("Shadowed Text")

    ef = shape.effect_format
    ef.enable_outer_shadow_effect()
    ef.outer_shadow_effect.blur_radius = 10      # softness in points
    ef.outer_shadow_effect.direction = 315       # angle: 315° = upper-left cast
    ef.outer_shadow_effect.distance = 8          # offset in points
    ef.outer_shadow_effect.shadow_color.color = Color.from_argb(128, 0, 0, 0)  # semi-transparent black

    prs.save("shadow.pptx", SaveFormat.PPTX)

Common direction values: 0 = right, 45 = lower-right, 90 = down, 270 = up, 315 = upper-left.

Glow Effect

Call ef.enable_glow_effect() to add a colored glow around the shape, then set radius and the glow color:

from aspose.slides_foss import ShapeType
from aspose.slides_foss.drawing import Color
import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    shape = prs.slides[0].shapes.add_auto_shape(ShapeType.ELLIPSE, 150, 100, 200, 200)

    ef = shape.effect_format
    ef.enable_glow_effect()
    ef.glow_effect.radius = 15
    ef.glow_effect.color.color = Color.gold

    prs.save("glow.pptx", SaveFormat.PPTX)

Soft Edge (Feathered Border)

Call ef.enable_soft_edge_effect() to add a feathered border around the shape, then set radius to control the feather distance in points:

from aspose.slides_foss import ShapeType
import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    shape = prs.slides[0].shapes.add_auto_shape(ShapeType.RECTANGLE, 100, 100, 350, 180)

    ef = shape.effect_format
    ef.enable_soft_edge_effect()
    ef.soft_edge_effect.radius = 12   # feather radius in points

    prs.save("soft-edge.pptx", SaveFormat.PPTX)

Blur

Call shape.effect_format.set_blur_effect() with a blur radius and a grow flag to apply a blur effect to the shape:

from aspose.slides_foss import ShapeType
import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    shape = prs.slides[0].shapes.add_auto_shape(ShapeType.RECTANGLE, 100, 100, 350, 180)

    shape.effect_format.set_blur_effect(radius=8, grow=True)

    prs.save("blur.pptx", SaveFormat.PPTX)

Checking and Removing Effects

Check ef.is_no_effects to detect whether any effect is active, then call disable_outer_shadow_effect() or disable_glow_effect() to remove specific effects:

from aspose.slides_foss import ShapeType
import aspose.slides_foss as slides

with slides.Presentation() as prs:
    shape = prs.slides[0].shapes.add_auto_shape(ShapeType.RECTANGLE, 100, 100, 200, 100)
    ef = shape.effect_format

    ef.enable_outer_shadow_effect()
    ef.enable_glow_effect()
    print(f"Has effects: {not ef.is_no_effects}")  # True

    ef.disable_outer_shadow_effect()
    ef.disable_glow_effect()
    print(f"Has effects: {not ef.is_no_effects}")  # False

3D Formatting (ThreeDFormat)

Bevel Effect

Set tdf.bevel_top.bevel_type to a BevelPresetType value and configure width and height to apply a bevel to the top face of the shape:

from aspose.slides_foss import ShapeType, BevelPresetType
import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    shape = prs.slides[0].shapes.add_auto_shape(ShapeType.RECTANGLE, 150, 150, 250, 120)
    shape.add_text_frame("3D Button")

    tdf = shape.three_d_format
    tdf.bevel_top.bevel_type = BevelPresetType.CIRCLE
    tdf.bevel_top.width = 12
    tdf.bevel_top.height = 6

    prs.save("bevel.pptx", SaveFormat.PPTX)

BevelPresetType values: CIRCLE, RELAXED_INSET, COOL_SLANT, DIVOT, RIBLET, HARD_EDGE, SLOPE, CONVEX

Camera Preset

Set tdf.camera.camera_type to a CameraPresetType value to change the projection angle applied to the 3D shape:

from aspose.slides_foss import ShapeType, BevelPresetType, CameraPresetType
import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    shape = prs.slides[0].shapes.add_auto_shape(ShapeType.RECTANGLE, 150, 150, 250, 120)
    tdf = shape.three_d_format
    tdf.bevel_top.bevel_type = BevelPresetType.CIRCLE
    tdf.bevel_top.width = 10
    tdf.camera.camera_type = CameraPresetType.PERSPECTIVE_ABOVE
    prs.save("camera.pptx", SaveFormat.PPTX)

Light Rig and Material

Set tdf.light_rig.light_type and tdf.light_rig.direction to control how light falls on the shape, then set tdf.material to one of the MaterialPresetType values:

from aspose.slides_foss import (
    ShapeType, BevelPresetType, CameraPresetType,
    LightRigPresetType, LightingDirection, MaterialPresetType,
)
import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    shape = prs.slides[0].shapes.add_auto_shape(ShapeType.RECTANGLE, 150, 150, 250, 120)
    shape.add_text_frame("Metal Button")

    tdf = shape.three_d_format
    tdf.bevel_top.bevel_type = BevelPresetType.CIRCLE
    tdf.bevel_top.width = 10
    tdf.bevel_top.height = 5
    tdf.camera.camera_type = CameraPresetType.PERSPECTIVE_ABOVE
    tdf.light_rig.light_type = LightRigPresetType.BALANCED
    tdf.light_rig.direction = LightingDirection.TOP
    tdf.material = MaterialPresetType.METAL
    tdf.depth = 20

    prs.save("3d-metal.pptx", SaveFormat.PPTX)

MaterialPresetType values: CLEAR, DK_EDGE, FLAT, MATTE, METAL, PLASTIC, POWDER, SOFT_EDGE, SOFTMETAL, TRANSLUCENT_POWDER, WARM_MATTE, LEGACY_MATTE, LEGACY_METAL, LEGACY_PLASTIC, LEGACY_WIREFRAME


Combining 2D and 3D Effects

You can apply both effect_format and three_d_format to the same shape:

from aspose.slides_foss import (
    ShapeType, FillType, BevelPresetType, CameraPresetType, MaterialPresetType,
)
from aspose.slides_foss.drawing import Color
import aspose.slides_foss as slides
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    shape = prs.slides[0].shapes.add_auto_shape(ShapeType.ROUND_CORNER_RECTANGLE, 150, 150, 300, 120)
    shape.add_text_frame("Premium Card")

    # Solid fill
    shape.fill_format.fill_type = FillType.SOLID
    shape.fill_format.solid_fill_color.color = Color.from_argb(255, 30, 80, 180)

    # 3D bevel
    tdf = shape.three_d_format
    tdf.bevel_top.bevel_type = BevelPresetType.CIRCLE
    tdf.bevel_top.width = 8
    tdf.camera.camera_type = CameraPresetType.PERSPECTIVE_ABOVE
    tdf.material = MaterialPresetType.PLASTIC

    # Drop shadow
    ef = shape.effect_format
    ef.enable_outer_shadow_effect()
    ef.outer_shadow_effect.blur_radius = 12
    ef.outer_shadow_effect.direction = 270
    ef.outer_shadow_effect.distance = 6
    ef.outer_shadow_effect.shadow_color.color = Color.from_argb(80, 0, 0, 0)

    prs.save("premium-card.pptx", SaveFormat.PPTX)

See Also

 English