Skip to main content
SDK 2.0.0. C++ API is shared with Windows. Enums: Parameter enums.

Point resource_path at resource.fbd

Pass the file, not a directory:
Resolve an absolute path at startup so cwd changes do not break fopen.

One engine, serial ProcessImage

Create returns one engine for the session, not a process-wide singleton. ImageFrame and the engine are not thread-safe. Serialize ProcessImage and mutating setters on one thread.
  • Create the engine and call process on the thread whose GL context is current. Input and output textures must belong to that context. CPU frames do not need a caller GL context. There is no context flag on the config.

FrameType on the frame

Large stills (preview vs export)

Do not feed full-resolution pixels into ProcessImage on every slider change, and do not throw the original away after scaling. When the photo opens, keep the full buffer and build one preview frame (long edge about 1280–1440). Slider changes process the preview (FrameType::Image). Export processes a full-resolution frame with the same setters. Output size matches the input. Camera preview stays capture resolution + FrameType::Video.

Intensities and skin-only

Realtime: start around 0.15–0.3. Reshape is [-1.0, 1.0]. Use SetBeautySkinOnly(true) so smoothing stays on skin.

Filters and stickers

.fbd path or bytes. Takes effect on the next ProcessImage. Do not swap assets every frame.

GetStats

Shared library

  • Development: LD_LIBRARY_PATH
  • Shipping: RPATH / RUNPATH, or install to /usr/local/lib + ldconfig
  • Keep libfacebetter.so and headers from the same SDK build (./scripts/build_linux.sh or the download zip)

OpenGL

  • Create the engine and call process on the thread whose GL context is current. Input and output textures must belong to that context. CPU frames do not need a caller GL context. There is no context flag on the config.

Pause when idle

Skip ProcessImage when the window is unmapped. engine.reset() when the session ends.

Auth

license_token for offline hosts; otherwise app_id + app_key online v2. Load secrets from env/config, not source. See Auth & License.