Skip to main content

Log Levels

Log level enumeration for controlling log output levels.

Log Configuration Class

Log configuration class for configuring log output methods and levels. Field Descriptions:
  • consoleEnabled: Whether to enable console output
  • fileEnabled: Whether to enable file output
  • level: Log level
  • fileName: Log file path (only effective when fileEnabled is true)

Process Mode

Image processing mode enumeration.
  • IMAGE: Image mode, suitable for single image processing
  • VIDEO: Video mode, suitable for video streams and live streaming scenarios, better performance

Engine Configuration

Engine configuration class for initializing the beauty engine. Field Descriptions:
  • appId: Application ID (optional, not required if licenseJson is provided)
  • appKey: Application key (optional, not required if licenseJson is provided)
  • licenseJson: License data JSON string (optional, if provided, takes priority and appId and appKey are not required)
  • externalContext: Whether to use external OpenGL context (default false)
    • true: Use the caller-provided GL context, SDK will not create/manage internal context
    • false: Use internal default context
Methods:
  • isValid(): Validate if configuration is valid
    • If licenseJson is provided, use license data verification
    • Otherwise, require appId and appKey for automatic online verification
Verification Priority:
  • If licenseJson is not empty, use license data verification (supports online response and offline license)
  • Otherwise, use appId and appKey for automatic online verification

Engine Interface

Main beauty effect engine class providing entry point for beauty functionality. Static Methods:
  • setLogConfig(LogConfig config): Set log configuration
Instance Methods:

Initialization and Release

  • BeautyEffectEngine(Context context, EngineConfig config): Constructor, create engine instance
  • void release(): Release engine resources

Parameter Settings

  • int setBeautyParam(BasicParam param, float value): Set basic beauty parameters (range 0.0 - 1.0)
  • int setBeautyParam(ReshapeParam param, float value): Set face reshape parameters (range 0.0 - 1.0)
  • int setBeautyParam(MakeupParam param, float value): Set makeup parameters (range 0.0 - 1.0)
  • int setLipstickStyle(LipstickStyle style): Set lipstick style (Rouge / Coral / Pink)
  • int setBlushStyle(BlushStyle style): Set blush style (Classic / Peach / Rose)
  • int setSkinOnlyBeauty(boolean enabled): Set whether beauty is applied only to skin regions
    • Parameter: enabled - true to enable skin-only beauty, false to apply to entire image
    • Return value: 0 indicates success, -1 indicates engine not initialized
  • int setVirtualBackground(VirtualBackgroundOptions options): Set virtual background
    • Parameter: VirtualBackgroundOptions object containing background mode and background image
    • Return value: 0 indicates success, -1 indicates engine not initialized, -2 indicates invalid parameters (options is null or invalid)

Filters & Stickers Management

  • int setFilter(String filterId): Set filter
    • Parameter: filterId unique filter identifier
  • int setFilterIntensity(float intensity): Set filter intensity
    • Parameter: intensity intensity value (range 0.0 - 1.0)
  • int setSticker(String stickerId): Set sticker
    • Parameter: stickerId unique sticker identifier, pass an empty string to clear the sticker
  • int registerFilter(String filterId, String fbdFilePath): Register filter from file
  • int registerFilter(String filterId, byte[] fbdData): Register filter from memory
  • int registerSticker(String stickerId, String fbdFilePath): Register sticker from file
  • int registerSticker(String stickerId, byte[] fbdData): Register sticker from memory
  • int unregisterFilter(String filterId): Unload filter
  • int unregisterAllFilters(): Unload all filters
  • int unregisterSticker(String stickerId): Unload sticker
  • int unregisterAllStickers(): Unload all stickers
  • String[] getRegisteredFilters(): Get list of registered filters
  • String[] getRegisteredStickers(): Get list of registered stickers

Callbacks

  • void setEngineEventCallback(OnEngineEventCallback callback): Set engine event callback to monitor license verification and engine initialization status
    • Callback provides: int code (event code), String message (event description)
    • Code 0 indicates success, non-zero indicates failure

Image Processing

  • ImageFrame processImage(ImageFrame inputFrame): Process image frame
    • Frame type is obtained from inputFrame.type field (FrameType.IMAGE or FrameType.VIDEO)
    • The processed image frame will maintain the same frame type
Return Value Descriptions:
  • Methods return int type:
    • 0 indicates success
    • -1 indicates engine not initialized
    • -2 indicates invalid parameters (only for setVirtualBackground method)
  • processImage returns ImageFrame: Processed image frame, returns null on failure

Beauty Parameters

Beauty parameter enumeration classes containing all beauty-related parameter type definitions.

Beauty Types

Define available beauty functionality types.

Basic Beauty Parameters

Basic beauty effect parameter types, all parameter value ranges are 0.0 - 1.0.

Face Reshape Parameters

Face reshape effect parameter types, all parameter value ranges are 0.0 - 1.0.

Makeup Parameters

Makeup effect parameter types, all parameter value ranges are 0.0 - 1.0.

Lipstick Style

Blush Style

Virtual Background Options

Virtual background effect configuration options.

ImageFrame

Image frame class for encapsulating image data and processing. Creation Methods:
  • createWithFile(String filePath): Create from file (supports PNG, JPG)
  • createWithRGBA(ByteBuffer data, int width, int height, int stride): Create from RGBA data
  • createWithBGRA(ByteBuffer data, int width, int height, int stride): Create from BGRA data
  • createWithRGB(ByteBuffer data, int width, int height, int stride): Create from RGB data
  • createWithBGR(ByteBuffer data, int width, int height, int stride): Create from BGR data
  • createWithI420(...): Create from I420 YUV data
  • createWithNV12(...): Create from NV12 YUV data
  • createWithNV21(...): Create from NV21 YUV data
  • createWithAndroid420(...): Create from Android Camera2 YUV_420_888 format
  • createWithTexture(int texture, int width, int height, int stride): Create from GPU texture (external texture input)
  • createWithBitmap(Bitmap bitmap): Create from Android Bitmap (Android only)
Image Operations:
  • int rotate(Rotation rotation): Rotate image (returns 0 for success)
  • int mirror(String mode): Mirror image (returns 0 for success)
    • Parameter: mode mirror mode, can be “horizontal”, “vertical”, or “both” (case insensitive)
  • void setMirror(String mode): Set mirror mode for engine processing (avoids extra format conversion)
    • Parameter: mode mirror mode, can be “horizontal”, “vertical”, or “both” (case insensitive)
    • Note: This only sets the mirror flag, actual mirroring happens during engine processing
  • ImageFrame convert(Format format): Format conversion method, returns converted ImageFrame
  • int toFile(String path, int quality): Save image to file (specify quality 1-100)
  • int toFile(String path): Save image to file (use default quality 90)
  • boolean isValid(): Check if image frame is valid
Resource Management:
  • void release(): Release native resources

Enum Types

Format

Image format enumeration.

Rotation

Image rotation angle enumeration.

Deprecated APIs

DeprecatedThe following APIs are deprecated.

Beauty Type Control

  • int enableBeautyType(BeautyType type, boolean enabled)
    • Description: [Deprecated] Enable or disable beauty type (No effect in parameter-driven mode)
    • Return Value: 0 indicates success
  • boolean isBeautyTypeEnabled(BeautyType type)
    • Description: [Deprecated] Check if beauty type is enabled (Always returns false)
    • Return Value: false
  • int disableAllBeautyTypes()
    • Description: [Deprecated] Disable all beauty types (Please reset effects by zeroing parameters)
    • Return Value: 0 indicates success