The Tencent Effect SDK offers beautification effects, filters, and special effects. For filters and special effects, you need to get the material list first and configure them in the SDK by specifying the effect ID.
Beautification
You can pass in beautification parameters during initialization. You can also call setBeautify
of the SDK to set beautification effects.
Currently, the SDK supports the following beautification effects:
type BeautifyOptions = {
whiten?: number,
dermabrasion?: number
lift?: number
shave?: number
eye?: number
chin?: number
darkCircle?: number;
nasolabialFolds?: number;
cheekbone?: number;
head?: number;
eyeBrightness?: number;
lip?: number;
forehead?: number;
nose?: number;
usm?: number;
}
Call setBeautify
of the SDK to set beautification effects:
sdk.setBeautify({
whiten: 0.2,
dermabrasion: 0,
lift: 0.3,
shave:0.1,
eye: 0.9,
chin: 0,
……
})
Filters
Given the relatively high cost of filter design, we offer some built-in filters which you can use directly.
1. Get the built-in filter list:
const filterList = await sdk.getCommonFilter()
2. Set the filter:
sdk.setFilter(filterList[0].EffectId, 0.5)
Special Effects
You can use the SDK’s built-in effects or effects you customized in the RT-Cube console. To learn about how to customize effects, please contact us.
const presetEffectList = await sdk.getEffectList({
Type: 'Preset'
})
const customEffectList = await sdk.getEffectList({
Type: 'Custom'
})
const lipList = await sdk.getEffectList({
PageNumber: 0,
PageSize: 10,
Name: '',
Label: ['Lip makeup'],
Type: 'Custom'
})
const eyeList = await sdk.getEffectList({
PageNumber: 0,
PageSize: 10,
Name: '',
Label: ['Eye makeup'],
Type: 'Custom'
})
sdk.setEffect([lipList[0].EffectId, eyeList[0].EffectId])
sdk.setEffect([
{
id: lipList[0].EffectId,
intensity: 0.5
},
{
id: eyeList[0].EffectId,
intensity: 0.7
})
sdk.setEffect([
{
id: lipList[0].EffectId,
intensity: 0.5,
filterIntensity: 0
},
{
id: eyeList[0].EffectId,
intensity: 0.7,
filterIntensity: 1
})
Note:
When customizing a special effect, you can add a filter to the effect. In such cases, you can use filterIntensity
to adjust the strength of the filter separately.
Disabling Detection
The performance overhead of AI detection is high. To reduce resource consumption, the SDK will automatically disable AI detection when no effects are used and enable AI detection again when effects are applied.
sdk.setBeautify({
whiten: 0,
dermabrasion: 0,
lift: 0,
shave:0,
eye: 0,
chin: 0,
……
})
sdk.setEffect('')
Was this page helpful?