- Documentation
- AI Effects
- Guides
- Filters
Filters
The ZegoEffects SDK provides video filters with different styles that can be used in a wide range of use cases, such as live video streaming, short videos, and more.
Prerequisites
Before you begin to use the SDK's video filters in your project, make sure you complete the following steps:
- Integrate the ZegoEffects SDK into your project. For details, see Integration.
- Implement the basic image processing functionality. For details, see Implementation.
Implementation steps
The SDK provides video filters with the following styles:
- Natural: Creamy, Brighten, Fresh, Autumn
- Gray: Cool, Night, Film-like
- Dreamy: Sunset, Cozily, Sweet
In general, you can take the following steps to use a filter:
- Turn on the filter by specifying the resource path of the filter.
- Set the filter parameters as needed. If not specified, the SDK uses the default settings.
Turn on a filter
To turn on a filter, do the following:
Call the
setFilter
method, passing the absolute path of the corresponding filter to thepath
parameter.Call the
setFilterParam
method to set the filter intensity.The value range of the
intensity
property ofZegoEffectsFilterParam
is [0, 100]. As this value gets larger, the filter effect gets more intense.
You can't superimpose the effects of different filters. Once you apply a new filter, the previous one (if any) will be overridden.
// Turn on a filter, passing in the absolute path of the corresponding filter.
[self.effects setFilter:@"/xxx/xxx/Night.bundle"];
// Set the filter intensity. The value range is [0, 100].
ZegoEffectsFilterParam *param = [[ZegoEffectsFilterParam alloc] init];
param.intensity = 100;
[self.effects setFilterParam:param];
Turn off the filter
To turn off the filter, call the setFilter
method with the path
parameter set to nil
.
// Turn off the filter.
[self.effects setFilter:nil];