Introduction

Aspose.Slides FOSS for Python lets you apply professional-quality visual effects to PowerPoint shapes entirely in Python, with no Microsoft Office and no API keys required. This guide shows how to use the fill system (solid and gradient), 2D effects (drop shadows and glow), and 3D formatting (bevels, camera presets, and materials) to produce polished presentations from code.

Quick Start

Install the package and apply a solid fill to a shape in a few lines:

pip install aspose-slides-foss
import aspose.slides_foss as slides
from aspose.slides_foss import ShapeType, FillType
from aspose.slides_foss.drawing import Color
from aspose.slides_foss.export import SaveFormat

with slides.Presentation() as prs:
    shape = prs.slides[0].shapes.add_auto_shape(
        ShapeType.ROUND_CORNER_RECTANGLE, 100, 100, 400, 150
    )
    shape.fill_format.fill_type = FillType.SOLID
    shape.fill_format.solid_fill_color.color = Color.from_argb(255, 30, 80, 180)
    prs.save("out.pptx", SaveFormat.PPTX)

The Fill System

Every shape has a fill_format that controls how its interior is painted. The five fill types cover the full range of PowerPoint’s design palette.

Solid Fill

FillType.SOLID paints the shape interior with a flat color. Set solid_fill_color.color with a Color.from_argb() value to control hue and optional transparency:

from aspose.slides_foss import ShapeType, FillType
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, 100, 100, 400, 150
    )
    shape.add_text_frame("Solid Fill")

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

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

Linear Gradient Fill

FillType.GRADIENT transitions between two or more colors across the shape. Add stops with gradient_stops.add(), set gradient_shape = GradientShape.LINEAR, and control the direction with linear_gradient_angle (90 = top-to-bottom):

from aspose.slides_foss import ShapeType, FillType, GradientShape
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, 400, 150
    )

    ff = shape.fill_format
    ff.fill_type = FillType.GRADIENT
    gf = ff.gradient_format
    gf.gradient_shape = GradientShape.LINEAR
    gf.linear_gradient_angle = 90   # top-to-bottom

    gf.gradient_stops.add(0.0, Color.from_argb(255, 30, 80, 180))   # top: blue
    gf.gradient_stops.add(1.0, Color.from_argb(255, 0, 200, 160))   # bottom: teal

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

2D Visual Effects

Outer Drop Shadow

Call effect_format.enable_outer_shadow_effect() to attach a drop shadow. Configure blur_radius (softness), direction (angle in degrees), and distance (offset from the shape edge):

from aspose.slides_foss import ShapeType, FillType
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, 100, 100, 350, 150
    )
    shape.add_text_frame("Drop Shadow")

    shape.fill_format.fill_type = FillType.SOLID
    shape.fill_format.solid_fill_color.color = Color.from_argb(255, 255, 255, 255)

    ef = shape.effect_format
    ef.enable_outer_shadow_effect()
    ef.outer_shadow_effect.blur_radius = 12
    ef.outer_shadow_effect.direction = 315   # upper-left
    ef.outer_shadow_effect.distance = 8
    ef.outer_shadow_effect.shadow_color.color = Color.from_argb(100, 0, 0, 0)

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

Glow Effect

Call effect_format.enable_glow_effect() to surround a shape with a colored halo. Set radius to control how far the glow extends from the edge (in points), then configure the glow color independently from the shape fill:

from aspose.slides_foss import ShapeType, FillType
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, 250, 250
    )
    shape.fill_format.fill_type = FillType.SOLID
    shape.fill_format.solid_fill_color.color = Color.from_argb(255, 20, 60, 140)

    ef = shape.effect_format
    ef.enable_glow_effect()
    ef.glow_effect.radius = 20
    ef.glow_effect.color.color = Color.from_argb(200, 0, 180, 255)

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

3D Formatting

Bevel and Material

The three_d_format property gives any flat shape a three-dimensional appearance. Combine a bevel with a camera preset and a material for the richest result:

from aspose.slides_foss import (
    ShapeType, FillType,
    BevelPresetType, CameraPresetType,
    LightRigPresetType, LightingDirection,
    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.RECTANGLE, 150, 150, 300, 130
    )
    shape.add_text_frame("Metal Button")

    # Blue solid fill
    shape.fill_format.fill_type = FillType.SOLID
    shape.fill_format.solid_fill_color.color = Color.from_argb(255, 20, 70, 160)

    # 3D bevel + camera + light + material
    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("metal-button.pptx", SaveFormat.PPTX)

Combining Effects on the Same Shape

Shadow and 3D formatting can coexist on a single shape, enabling polished “card” designs:

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, 120, 120, 360, 150
    )
    shape.add_text_frame("Premium Card")

    # 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 = 14
    ef.outer_shadow_effect.direction = 270
    ef.outer_shadow_effect.distance = 8
    ef.outer_shadow_effect.shadow_color.color = Color.from_argb(70, 0, 0, 0)

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

Getting Started

Install Aspose.Slides FOSS for Python from PyPI using pip (no compiler or runtime required):

pip install aspose-slides-foss

No Microsoft Office installation or license keys are required; all processing runs in the local Python process with no external dependencies.