logo
On this page

Basic Beauty Effects

2024-01-02

Feature Overview

ZEGO provides basic beauty effects to present users with good skin condition and create unique, natural beauty effects. This feature is commonly used in scenarios such as video calls and live streaming.

Developers can enable the beauty effects switch, and then adjust the degree of whitening, smoothing, sharpening, and rosiness as needed to easily achieve basic beauty effects.

Prerequisites

Before implementing beauty effects, please ensure:

Usage Steps

Initialize the basic beauty effects environment

If you need to use basic beauty effects, you must call the startEffectsEnv interface to initialize the beauty effects environment before startPreview starts previewing or before startPublishingStream starts publishing streams.

// Create beauty effects environment
ZegoExpressEngine.instance.startEffectsEnv()

Toggle basic beauty effects

Note

There is no order requirement for calling the enableEffectsBeauty interface and the setEffectsBeautyParam interface.

After initializing the beauty effects environment, you can call the enableEffectsBeauty interface before or after publishing streams to enable or disable beauty effects in real time.

// Toggle beauty effects
ZegoExpressEngine.instance.enableEffectsBeauty(true)

Set basic beauty effects parameters

After initializing the beauty effects environment, you can call the setEffectsBeautyParam interface before or after publishing streams to set beauty effects parameters in real time.

  • smoothIntensity: Smoothing, performs smoothing while retaining facial details, such as retaining moles on the face.
  • whitenIntensity: Whitening, increases the overall brightness of the screen to whiten the face.
  • rosyIntensity: Rosiness, applies warm color processing to the overall screen.
  • sharpenIntensity: Sharpening, applies sharpening processing to the overall screen. When the screen is slightly blurry, you can slightly increase sharpening to make contours clearer.

The value range for all four parameters above is 0 to 100. The larger the value, the higher the degree of beauty effects. The default value is 50.

// Create beauty effects parameter object
let beautyParam = new ZegoEffectsBeautyParam()

// Whitening, rosiness, smoothing, sharpening
beautyParam.whitenIntensity = 50
beautyParam.rosyIntensity = 50
beautyParam.smoothIntensity = 50
beautyParam.sharpenIntensity = 50

// Set beauty effects parameters
ZegoExpressEngine.instance.setEffectsBeautyParam(beautyParam)

Destroy the basic beauty effects environment

When the enableEffectsBeauty interface is called and set to "false", the beauty effects will be disabled, but the beauty effects module will still occupy resources and consume performance. If you want to completely release resources and save performance consumption, you need to call the stopEffectsEnv interface to destroy the beauty effects environment before previewing and publishing streams.

Note

When destroyEngine is called to destroy the engine, the SDK will automatically destroy the beauty effects environment.

// Disable beauty effects
ZegoExpressEngine.instance.enableEffectsBeauty(false)

// Destroy beauty effects environment
ZegoExpressEngine.instance.stopEffectsEnv()

Previous

Video Capture Rotation

Next

FAQ

On this page

Back to top