Skip to main content
Applies to: Windows and Linux. All APIs are in the facebetter namespace.
SDK version: 1.3.1

Logging

LogLevel

LogConfig

Log configuration struct. Fields:
  • console_enabled — write to stdout (default false)
  • file_enabled — write to a file (default false)
  • level — minimum log level to output (default Info)
  • file_name — log file path; only used when file_enabled = true (default "")

Engine

EngineConfig

Engine initialization config struct. Fields:
  • app_id — application ID from the dashboard
  • app_key — application key from the dashboard
  • resource_path — path to resource.fbd (relative or absolute)
  • license_json — offline/online license JSON string (optional)
  • external_context — whether the caller provides the OpenGL context (default false)
Authentication priority:
  1. If license_json is non-empty → use license JSON (supports both online response and offline license)
  2. Otherwise → use app_id + app_key with network verification

BeautyEffectEngine

The main beauty engine class. Non-copyable, non-assignable.

Static Methods

SetLogConfig
Set the global SDK log configuration. Must be called before Create to capture initialization messages. Returns 0 on success, non-zero on failure.
Create
Create and initialize an engine instance. Returns nullptr on failure.

Beauty Parameters

SetBeautyParam (Basic)
Set a basic skin-beauty parameter. All values in [0.0, 1.0]; 0 disables the effect.
SetBeautyParam (Reshape)
SetBeautyParam (Makeup)
SetLipstickStyle / SetBlushStyle
SetBeautyParam (ChromaKey)
SetVirtualBackground
Configure virtual background.
SetSkinOnlyBeauty
Set whether beauty effects are applied only to skin regions. When enabled, beauty effects (smoothing, whitening, etc.) will only be applied to detected skin areas, leaving non-skin areas unchanged.

Filter Management

SetFilter
Apply a LUT filter by ID. Pass "" to clear.
SetFilterIntensity
Set current filter intensity [0.0, 1.0].
RegisterFilter
Register a custom filter from a .fbd file path or memory buffer.
UnregisterFilter / UnregisterAllFilters
GetRegisteredFilters

Sticker Management

SetSticker
Apply a sticker by ID. Pass "" to clear.
RegisterSticker
Register a custom sticker from a .fbd file path or memory buffer.
UnregisterSticker / UnregisterAllStickers
GetRegisteredStickers

Callbacks

SetCallbacks
Register engine event and data callbacks.

Image Processing

ProcessImage
Apply all configured beauty effects to the input frame and return the processed frame. Returns nullptr on failure. The engine tries to keep the output format consistent with the input format.

Deprecated APIs

DeprecatedThe following methods are no-ops in parameter-driven mode. They are retained for binary compatibility only and will be removed in a future release.

Image

Format

Rotation

FrameType

Set via frame->type. Controls how the engine processes each frame.

ImageFrame

Image frame class. Non-copyable. Thread safety: ImageFrame is not thread-safe. Do not call Rotate, Mirror, Convert, etc. on the same instance from multiple threads simultaneously.

Factory Methods

CreateWithFile
Load from a JPEG, PNG, or BMP file. Returns nullptr on failure.
Create (general)
Create from memory for single-plane formats (RGBA / BGRA / RGB / BGR).
For multi-plane YUV (I420/NV12/NV21), use the dedicated methods instead.
CreateWithRGBA
CreateWithBGRA
CreateWithRGB
CreateWithBGR
CreateWithI420
CreateWithNV12
CreateWithNV21
CreateWithTexture
Create from an OpenGL texture handle. Used for GPU texture input.
CreateWithAndroid420
For Android Camera2 YUV_420_888 (primarily used on Android).

Instance Methods

Rotate
Rotate the frame in-place. Returns 0 on success.
Mirror
Mirror the frame in-place. mode values (case-insensitive): "horizontal", "vertical", "both".
SetMirror
Set a mirror flag. The engine applies the mirror during ProcessImage without an extra format round-trip. Pass "" to clear.
Convert
Convert to another pixel format; returns a new ImageFrame. If the target format matches the current format, the returned frame shares the underlying buffer. Returns nullptr if conversion is not possible.
ToFile
Save the frame to a file. quality is the JPEG compression quality (1100); ignored for PNG. Returns 0 on success.

Data Accessors

Public Field


Callbacks and Events

EngineEventCode

EngineCallbacks


Data Structures

Point2d

Rect

FaceDetectionResult

Single face detection result.
Example — reading keypoints:

Beauty Param Enumerations

BeautyType

beauty_params::Basic

beauty_params::Reshape

beauty_params::Makeup

beauty_params::ChromaKey

beauty_params::BackgroundMode

beauty_params::VirtualBackgroundOptions


Notes

Thread safety: BeautyEffectEngine and ImageFrame are not thread-safe. Add external locking for multi-threaded use. Memory management: All factory methods return std::shared_ptr. Memory is managed automatically. Read-only data: Pointers returned by Data() etc. are const. Do not write to them; create a new ImageFrame if you need to modify pixel data. SetRenderView not available: This method exists only on iOS and macOS. Do not call it on Windows or Linux.