During a video call or live streaming, users often want to improve their on-screen appearance, which can help improve their confidence. The Agora RTC SDK provides APIs to help you easily implement basic image enhancement. Users can enable this functionality and then adjust a number of image enhancement options including skin smoothing, acne removal, and a "rosy cheeks" effect to achieve natural-looking enhancements.
setBeautyEffectOptions
to enable image enhancement and set the image enhancement options.setBeautyEffectOptions
:
libagora_video_process_extension.so
AgoraVideoProcessExtension.xcframework
AgoraVideoProcessExtension.framework
or AgoraVideoProcessExtension.xcframework
libagora_video_process_extension.dll
// Java
mRtcEngine.setBeautyEffectOptions(true, new BeautyOptions(LIGHTENING_CONTRAST_NORMAL, 0.5F, 0.5F, 0.5F));
// Swift
let options = AgoraBeautyOptions()
options.lighteningContrastLevel = .normal
options.rednessLevel = 0
options.smoothnessLevel = 0
options.lighteningLevel = 0
agoraKit.setBeautyEffectOptions(true, options: options)
// Objective-C
AgoraBeautyOptions *options = [[AgoraBeautyOptions alloc] init];
options.lighteningContrastLevel = AgoraLighteningContrastNormal;
options.rednessLevel = 0;
options.smoothnessLevel = 0;
options.lighteningContrastLevel = 0;
[self.agoraKit setBeautyEffectOptions:YES options:options];
// C++
bool enabled = true;
agora::rtc::BeautyOptions options;
options.lighteningContrastLevel = BeautyOptions::LIGHTENING_CONTRAST_NORMAL;
options.lighteningLevel = 0.7;
options.smoothnessLevel = 0.5;
options.rednessLevel = 0.1;
m_lpAgoraEngine->setBeautyEffectOptions(enabled, options);
// Web 3.x
// setBeautyEffectOptions is an asynchronous method and must be called with Promise or async/await keywords.
// To enable image enhancement immediately after creating a video stream, you can call setBeautyEffectOptions in the Client.on("stream-published") callback.
var streamPublishedHandler = async function() {
await localStream.setBeautyEffectOptions(true, {
lighteningContrastLevel: 1,
lighteningLevel: 0.7,
smoothnessLevel: 0.5,
rednessLevel: 0.1
});
client.off("stream-published", streamPublishedHandler);
}
client.on("stream-published", streamPublishedHandler);
// Web 4.x
// Call setBeautyEffect in LocalVideoTrack to set the basic image enhancement function.
// The localVideoTrack in the following example is a local camera video track object created with AgoraRTC.createCameraVideoTrack.
localVideoTrack.setBeautyEffect(true, {
lighteningContrastLevel: 1,
lighteningLevel: 0.7,
smoothnessLevel: 0.5,
rednessLevel: 0.1
}).then(() => { console.log("set Beauty Effect Options success!") });
Agora also provides an Online Demo for you to experience the basic image enhancement function.
setBeautyEffectOptions
setBeautyEffectOptions
setBeautyEffectOptions
setBeautyEffectOptions
setBeautyEffectOptions
setBeautyEffect
setBeautyEffectOptions
setBeautyEffectOptions
setBeautyEffectOptions
setBeautyEffectOptions
setBeautyEffectOptions
setBeautyEffectOptions
method of the Agora Web 3.x SDK, note that this method has call sequence restrictions and image enhancement options are only available for high-quality video streams. See Web 3.x API reference.