Add SDK Dependency
Add to yourpubspec.yaml:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Implement beauty effects in Flutter
pubspec.yaml:
dependencies:
facebetter_flutter: ^1.4.4
flutter pub get
cd ios && pod install
import 'package:facebetter_flutter/facebetter_flutter.dart';
FBBeautyEffectEngine.setLogConfig(
FBLogConfig(consoleEnabled: true, level: FBLogLevel.debug),
);
setLogConfig before init() to see initialization logs.await FBBeautyEffectEngine.init(
FBEngineConfig(appId: 'your appId', appKey: 'your appKey'),
);
final engine = FBBeautyEffectEngine.sharedInstance;
[0.0, 1.0]. Set to 0 to disable.await engine.setBasicParam(FBBasicParam.smoothing, 0.8);
await engine.setBasicParam(FBBasicParam.whitening, 0.6);
await engine.setReshapeParam(FBReshapeParam.faceThin, 0.5);
await engine.setReshapeParam(FBReshapeParam.eyeSize, 0.3);
await engine.setMakeupParam(FBMakeupParam.lipstick, 0.5);
await engine.setVirtualBackground(FBBackgroundMode.blur);
await engine.setVirtualBackground(FBBackgroundMode.image,
backgroundImage: FBImageFrame(...));
await engine.registerFilter('chuxin', '/path/to/chuxin.fbd');
await engine.setFilter('chuxin');
await engine.setFilterIntensity(0.8);
await engine.registerSticker('cherry', '/path/to/cherry.fbd');
await engine.setSticker('cherry');
final inputFrame = FBImageFrame(
width: 1080, height: 1920, stride: 4320,
data: rgbaBytes, format: FBImageFormat.rgba,
);
final outputFrame = await engine.processImage(inputFrame);
await engine.release();
