UyaliBeautySDK documentation

UyaliBeautySDK integration docs

UyaliBeautySDK is built for real-time video scenarios such as camera, live streaming, short video, meetings, and online teaching. It provides base beauty, detailed face reshape, body shaping, makeup overlay, face landmarks, and body pose capabilities. This document covers platform integration, license checks, frame-processing entry points, and the names, ranges, and effects of all adjustable parameters.

Integration overview

The docs use real code from the UyaliBeautySDK demo: create and reuse one engine instance, send camera frames, image frames, or textures into the SDK, and update only the current parameter state on that same engine instance.

Engine instance

Each platform section shows how the demo holds the engine instance and writes License and parameter state into the same instance.

Frame input

Supported input formats are documented in each platform section, so users only need to read the platform they are integrating.

Parameter updates

When sliders, switches, presets, or makeup selections change, call the parameter APIs only. The SDK uses the new values on later frames.

Integration model

The SDK engine is not an object that should be re-created every time a parameter changes. Reuse one instance for a preview, live stream, meeting, or image-editing flow, then update parameters after frame processing is connected.

Runtime model

The SDK should not be initialized again for each parameter entry point. The demo keeps one engine instance for a preview or editing flow, starts frame processing first, and applies all later parameter updates to the same instance.

ItemDescription
Engine instanceThe SDK does not require a process-wide singleton. Each platform section shows the instance ownership used by the demo.
Initialization countCreate one engine instance for a camera preview, live stream, meeting, or image-editing flow and reuse it inside that flow. Do not re-create it per frame or per slider change.
License loadingAfter the License is loaded into the current engine instance, the SDK records authorization status and module capabilities. The app layer can query capabilities to decide which features to show.
Parameter stateParameters are stored on the current engine instance. After frame processing is connected, slider changes only need to update parameters; later frames use the new values.
Frame processingThe process APIs handle the current input frame, read the parameter state on the current engine instance, and output the processed image.
Parameter updates

After initialization and frame processing are connected, beauty, reshape, body, and makeup adjustments are all parameter writes on the same engine instance. The SDK reads those values on the next processed frame.

iOS integration

The iOS demo uses UyaliBeautyEngine to process RGBA CVPixelBuffer camera output directly. The engine instance is held by the page, and parameter updates continue to write into that same instance.

Engine

UyaliBeautyEngine, named filter in the demo.

Input format

RGBA CVPixelBuffer from AVCapture or a video frame-processing pipeline.

Processing APIs

process(pixelBuffer:) processes in place, while processWithOutput(pixelBuffer:) returns an output frame.

Demo integration code

// BeautyFilterController.swift excerpt
import UIKit
import UyaliBeautySDK

class BeautyFilterController: UIViewController, PFCameraDelegate {
    private var camera: PFCamera!
    private var openGLView: PFOpenGLView!
    private let filter = UyaliBeautyEngine()

    override func viewDidLoad() {
        super.viewDidLoad()
        camera = PFCamera()
        camera.delegate = self
        camera.startCapture()
    }

    func didOutputVideoSampleBuffer(_ sampleBuffer: CMSampleBuffer!) {
        guard let sampleBuffer = sampleBuffer,
              let pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else {
            return
        }
        filter.process(pixelBuffer: pixelBuffer)
        openGLView.display(pixelBuffer)
    }
}

License

let result = filter.activateLicense(licenseString)
if result.status != .valid {
    print(result.message)
}

Parameter updates

// FaceBeautyDelegate callback excerpt
func getBeautyDeltaValue(value: Float, type: Int) {
    if type == 100 {
        filter.white_delta = value
    } else if type == 101 {
        filter.skin_delta = value
    } else if type == 102 {
        filter.eyeBright_delta = value
    } else if type == 103 {
        filter.teethBright_delta = value
    } else if type == 104 {
        filter.darkCircle_delta = value
    }
}

Android integration

The Android demo uses a texture pipeline for real-time preview. UyaliBeautyTextureProcessor holds the same UyaliBeautyEngine instance, receives the camera OES texture, and outputs the processed texture.

Engine

Call textureProcessor.engine() to get the current UyaliBeautyEngine.

Real-time input

External OES Texture, suitable for Camera preview, GL rendering, and pre-push processing.

Other inputs

Supports RGBA ByteBuffer, Bitmap, Camera Image, and YUV420.

Demo integration code

// UyaliBeautyView.java excerpt
public class UyaliBeautyView extends GLSurfaceView implements GLSurfaceView.Renderer {
    private final UyaliBeautyTextureProcessor textureProcessor;
    private final UyaliBeautyEngine engine;

    public UyaliBeautyView(Context context, AttributeSet attrs) {
        super(context, attrs);
        textureProcessor = new UyaliBeautyTextureProcessor(context);
        engine = textureProcessor.engine();
        setEGLContextClientVersion(3);
        setRenderer(this);
        setRenderMode(RENDERMODE_WHEN_DIRTY);
    }

    private void drawCameraFrame() {
        UyaliBeautyTextureInput input = UyaliBeautyTextureInput.externalOes(
                oesTextureId,
                transform,
                viewWidth,
                viewHeight,
                sourceWidth,
                sourceHeight,
                mirrorFrontCamera,
                cameraSurfaceTexture.getTimestamp(),
                true);
        UyaliBeautyTextureFrame outputFrame = textureProcessor.process(input);
        if (outputFrame != null && outputFrame.isValid()) {
            drawTexture2dToViewport(outputFrame.textureId(),
                    UyaliBeautyTextureInput.IDENTITY_TRANSFORM,
                    viewWidth,
                    viewHeight,
                    outputFrame.width(),
                    outputFrame.height(),
                    true);
        }
    }
}

CPU / image input

UyaliBeautyEngine beauty = beautyView.engine();

beauty.processRgbaInPlace(rgbaBuffer, width, height);

Bitmap output = beauty.processBitmap(bitmap);

UyaliBeautyFrame frame = beauty.process(image, rotationDegrees);

License

UyaliBeautyEngine engine = currentEngine();
UyaliBeautyLicenseResult result = engine.activateLicense(licenseText);
if (result.getStatus() != UyaliBeautyLicenseStatus.VALID) {
    Log.w("UyaliBeauty", result.getMessage());
}

Parameter updates

// MainActivity.java: SeekBar parameter update excerpt
private void applyFeatureValue(Feature feature, int progress, TextView valueLabel) {
    float actual = feature.signed ? progress - 50f : progress;
    valueLabel.setText(displayValue(progress, feature.signed));
    UyaliBeautyEngine engine = currentEngine();
    if (engine != null) {
        engine.setParameter(feature.parameter, actual);
    }
    updateCameraProcessingMode();
    requestCurrentRender();
}

HarmonyOS integration

The HarmonyOS demo holds UyaliBeautyEngine at page level. The real-time camera pipeline can use processCameraFrame, while PixelMap images or preview frames can use processPixelMapInPlace.

Engine

Create private engine: UyaliBeautyEngine = new UyaliBeautyEngine() in the page.

Camera input

Supports NativeImage / YUV420 camera frames and can output to Surface.

Image input

Supports RGBA ArrayBuffer and editable PixelMap.

Demo integration code

// CameraBeautyPage.ets excerpt
import { UyaliBeautyEngine } from 'uyali_beauty_sdk';

@Entry
@Component
struct CameraBeautyPage {
  private engine: UyaliBeautyEngine = new UyaliBeautyEngine();

  private async handleCameraFrame(frame: CameraFrame): Promise<void> {
    syncBeautyState(this.engine, this.values, this.makeupTypes, this.frontCamera);

    if (frame.kind === 'yuv420') {
      const framePayload = this.cameraFramePayload(frame);
      const result = this.engine.processCameraFrame(framePayload);
      this.status = result.ok ? 'Beauty processing' : 'Current frame failed';
      return;
    }

    const pixelMap = frame.pixelMap;
    const ok = await this.engine.processPixelMapInPlace(pixelMap);
    this.status = ok ? 'Beauty processing' : 'Current frame failed';
  }
}

License

import { UyaliBeautyLicenseStatus } from 'uyali_beauty_sdk';

const result = this.engine.loadLicenseFromRawfile(context, 'uyali/license.lic');
if (result.status !== UyaliBeautyLicenseStatus.VALID) {
  console.info(result.message);
}

Parameter updates

// BeautyCatalog.ets: page state sync to SDK excerpt
export function syncBeautyState(engine: UyaliBeautyEngine, values: Map<string, number>,
  makeupTypes: Map<string, number>, frontCamera: boolean = false): void {
  engine.setCameraFacing(frontCamera);
  BEAUTY_ITEMS.forEach((item: BeautyItem) => {
    engine.setParameter(item.parameter, values.get(item.parameter) ?? item.defaultValue);
  });
  MAKEUP_GROUPS.forEach((group: MakeupGroup) => {
    engine.setParameter(group.parameter, values.get(group.parameter) ?? 0);
    engine.setMakeupType(group.typeParameter, makeupTypes.get(group.typeParameter) ?? 0);
  });
}

License

The SDK supports local signature verification. After app startup, load the License and check whether the authorization is valid. Without a commercial License, whitening and smoothing are free without time limits; all other features can be tried for 120 seconds after SDK initialization.

ModuleRelated parametersCapability scope
WHITENwhite / white_deltaWhitening
SMOOTHskin / skin_deltaSmoothing
BEAUTYeyeBright, teethBright, darkCircleBright eyes, teeth whitening, dark circle reduction
RESHAPEDetailed face reshape parametersFace shape, facial features, brows, eyes, nose, and lips
BODYBody shaping parametersBody, waist, legs, shoulders, and neck adjustments
MAKEUPMakeup intensity and typeEyebrow, eyeshadow, colored contacts, blush, lipstick
FACE_LANDMARKSFace detection outputFace landmarks and contour information
BODY_POSEBody detection outputBody keypoints and segmented contour information
DEBUG_OUTPUTSDebug outputsDetection information and debug data
CUSTOM_MAKEUP_ASSETSCustom makeup assetsReplace or extend makeup resources

Beauty

The table below lists base beauty parameters. They are not SDK initialization steps; they are usually written from sliders, switches, presets, or config.

FeatureiOS parameterAndroid / HarmonyOS parameterRangeEffect
Whiteningwhite_deltawhite0-100Improves skin brightness and translucency. 0 disables the effect.
Smoothingskin_deltaskin0-100Reduces skin texture and noise while preserving facial edges. 0 disables the effect.
Bright eyeseyeBright_deltaeyeBright0-100Enhances eye whites and catchlights for clearer eyes.
Teeth whiteningteethBright_deltateethBright0-100Brightens the teeth area, suitable for selfies and live streaming.
Dark circle reductiondarkCircle_deltadarkCircle0-100Softens under-eye darkness for a fresher facial state.

Face reshape

Face reshape depends on face landmark detection and fits selfie, live, and short-video scenes. Products usually provide natural presets first, then allow users to tune individual parameters.

FeatureiOS parameterAndroid / HarmonyOS parameterRangeEffect
Head sizeheadReduce_deltaheadReduce0-100Reduces the overall head contour, suitable for half-body and full-body shots.
Face slimmingfaceThin_deltafaceThin0-100Narrows the cheek contour and enhances facial lines.
Face narrowingfaceNarrow_deltafaceNarrow0-100Compresses face width for a narrower face shape.
V-linefaceV_deltafaceV0-100Strengthens the V-shaped line from jaw to chin.
Small facefaceSmall_deltafaceSmall0-100Reduces the overall face area, more comprehensive than face slimming alone.
Chinchin_deltachin-50-50Negative values shorten the chin; positive values lengthen it.
Foreheadforehead_deltaforehead-50-50Negative values lower forehead height; positive values increase it.
Cheekbonescheekbone_deltacheekbone-50-50Negative values soften outward cheekbones; positive values enhance the contour.
Eye enlargementeyeBig_deltaeyeBig0-100Enlarges the eye area for more expressive eyes.
Eye distanceeyeDistance_deltaeyeDistance-50-50Negative values bring eyes closer; positive values move them apart.
Inner eye cornereyeCorner_deltaeyeCorner0-100Adjusts inner eye corner openness and lengthens the perceived eye shape.
Lower eyelideyelidDown_deltaeyelidDown0-100Expands lower eyelid space for a rounder eye shape.
Nose slimmingnoseThin_deltanoseThin0-100Narrows the bridge and nose tip.
Nose wingnoseWing_deltanoseWing0-100Narrows the nose wing area and reduces horizontal spread.
Nose lengthnoseLong_deltanoseLong-50-50Negative values shorten the nose; positive values lengthen it.
Nose rootnoseRoot_deltanoseRoot0-100Enhances the nose bridge root and improves bridge depth.
Eyebrow distanceeyebrowDistance_deltaeyebrowDistance-50-50Negative values bring brows closer; positive values move them apart.
Eyebrow thicknesseyebrowThin_deltaeyebrowThin-50-50Negative values thin the brows; positive values thicken them.
Mouth shapemouth_deltamouth-50-50Negative values reduce mouth size; positive values enlarge it.

Body shaping

Body shaping depends on body keypoints and contour detection. It fits standing, half-body, and full-body shots. For multi-person or occluded scenes, lower defaults can avoid excessive distortion.

FeatureiOS parameterAndroid / HarmonyOS parameterRangeEffect
Body slimmingbodySlim_deltabodySlim0-100Narrows the overall body contour.
Waist slimmingwaistSlim_deltawaistSlim0-100Tightens the waist lines on both sides.
Leg slimminglegSlim_deltalegSlim0-100Narrows the horizontal leg contour.
Shoulder narrowingshoulderNarrow_deltashoulderNarrow0-100Narrows shoulder width.
Arm slimmingarmSlim_deltaarmSlim0-100Narrows upper-arm and forearm areas.
Calf refinementcalfSlim_deltacalfSlim0-100Refines the outer calf contour.
Abdomen slimmingabdomenSlim_deltaabdomenSlim0-100Tightens the abdomen contour.
Long legslegLong_deltalegLong0-100Stretches leg proportions.
HeightbodyHeight_deltabodyHeight0-100Stretches overall body height.
Leg shapelegShape_deltalegShape0-100Optimizes leg curvature and outward spread.
Swan neckneckLength_deltaneckLength0-100Lengthens the neck line.
Right-angle shouldersshoulderShape_deltashoulderShape0-100Adjusts the neck-shoulder angle for straighter shoulders.

Makeup parameters

Makeup is controlled by type plus intensity. The type is usually set when users choose makeup or switch presets. Type 0 means no makeup asset; intensity 0 hides the effect even if a type is selected.

FeatureiOS parameterAndroid / HarmonyOS parameterRangeEffect
Eyebrow intensitymakeup_eyebrow_deltamakeupEyebrow0-100Controls eyebrow makeup overlay intensity; use with an eyebrow type.
Eyeshadow intensitymakeup_eyeshadow_deltamakeupEyeshadow0-100Controls eyeshadow opacity and blending strength.
Colored contacts intensitymakeup_pupil_deltamakeupPupil0-100Controls colored contacts overlay intensity.
Blush intensitymakeup_blush_deltamakeupBlush0-100Controls blush overlay intensity.
Lipstick intensitymakeup_rouge_deltamakeupRouge0-100Controls lip color overlay intensity.

Makeup type values

FeatureiOS type parameterAndroid / HarmonyOS type parameterRangeEffectValues
Eyebrow typemakeup_eyebrow_typemakeupEyebrowType0-10Selects eyebrow assets. 0 means no eyebrow makeup.
0 eyebrow_none1 eyebrow_biaozhun2 eyebrow_cupin3 eyebrow_juanyan4 eyebrow_liuxing5 eyebrow_liuye6 eyebrow_qiubo7 eyebrow_wanyue8 eyebrow_xinyue9 eyebrow_yesheng10 eyebrow_yuanshan
Eyeshadow typemakeup_eyeshadow_typemakeupEyeshadowType0-11Selects eyeshadow assets. 0 means no eyeshadow makeup.
0 eyeshadow_none1 eyeshadow_dadise2 eyeshadow_fuguse3 eyeshadow_fangtangfen4 eyeshadow_huoliju5 eyeshadow_jinzongse6 eyeshadow_pengkezong7 eyeshadow_tianchengse8 eyeshadow_xingguangfen9 eyeshadow_yanfense10 eyeshadow_yeqiangweise11 eyeshadow_yuanqicheng
Colored contacts typemakeup_pupil_typemakeupPupilType0-12Selects colored contacts assets. 0 means no contacts makeup.
0 pupil_none1 pupil_jiaopianzong2 pupil_mitangzong3 pupil_xingyelan4 pupil_jizhouhei5 pupil_wuraohui6 pupil_chunrifen7 pupil_tianchalv8 pupil_siyecaolv9 pupil_kuangyelan10 pupil_qiangweifenhui11 pupil_haifenglan12 pupil_yueqiuzong
Blush typemakeup_blush_typemakeupBlushType0-36Selects blush assets. 0 means no blush makeup.
0 blush_none1 blush_wugu_naixingse2 blush_wugu_naijuse3 blush_wugu_mitaoju4 blush_wugu_yanxunmeigui5 blush_wugu_niunaicaomei6 blush_chayi_naixingse7 blush_chayi_naijuse8 blush_chayi_mitaoju9 blush_chayi_yanxunmeigui10 blush_chayi_niunaicaomei11 blush_chulian_naixingse12 blush_chulian_naijuse13 blush_chulian_mitaoju14 blush_chulian_yanxunmeigui15 blush_chulian_niunaicaomei16 blush_chunqing_naixingse17 blush_chunqing_naijuse18 blush_chunqing_mitaoju19 blush_chunqing_yanxunmeigui20 blush_chunqing_niunaicaomei21 blush_qiji_naixingse22 blush_qiji_naijuse23 blush_qiji_mitaoju24 blush_qiji_yanxunmeigui25 blush_qiji_niunaicaomei26 blush_shaonv_naixingse27 blush_shaonv_naijuse28 blush_shaonv_mitaoju29 blush_shaonv_yanxunmeigui30 blush_shaonv_niunaicaomei31 blush_wugu_makalongfen32 blush_chayi_makalongfen33 blush_chulian_makalongfen34 blush_chunqing_makalongfen35 blush_qiji_makalongfen36 blush_shaonv_makalongfen
Lipstick typemakeup_rouge_typemakeupRougeType0-12Selects lipstick assets. 0 means no lip makeup.
0 rouge_none1 rouge_meizise2 rouge_doushafen3 rouge_fuguse4 rouge_guimeihong5 rouge_jiangguose6 rouge_nanguase7 rouge_shiliuhong8 rouge_mitaose9 rouge_shanhuse10 rouge_xingguanghong11 rouge_anyezi12 rouge_shaonvfen

iOS example

beauty.makeup_eyebrow_type = .eyebrow_xinyue
beauty.makeup_eyebrow_delta = 45
beauty.makeup_rouge_type = .rouge_mitaose
beauty.makeup_rouge_delta = 35

Android example

beauty.setMakeupType("makeupEyebrowType", 8);
beauty.setParameter("makeupEyebrow", 45f);
beauty.setMakeupType("makeupRougeType", 8);
beauty.setParameter("makeupRouge", 35f);

HarmonyOS example

beauty.setMakeupType('makeupEyebrowType', 8);
beauty.setParameter('makeupEyebrow', 45);
beauty.setMakeupType('makeupRougeType', 8);
beauty.setParameter('makeupRouge', 35);

I/O and debug

Orientation and mirroring

Camera pipelines should confirm orientation and mirroring before passing data to the SDK. Related APIs and input formats are documented in the platform sections.

Reset parameters

resetAllFilters restores beauty, reshape, body, and makeup parameters to the default disabled state.

Detection outputs

After the corresponding capability is licensed, you can read the latest face landmarks, body keypoints, contour labels, and debug information for display or diagnostics.

FAQ

Can parameters exceed the documented ranges?
The app UI should keep values within the documented ranges to avoid uncontrolled distortion across platforms or input resolutions.
Why does makeup not appear after selecting a type?
Set both type and intensity, and confirm the License includes the MAKEUP capability. Type 0 or intensity 0 hides the makeup.
Why do some advanced effects stop working after a while without a License?
Without a commercial License, features except whitening and smoothing provide a 120-second trial. Read getLicenseTrialSecondsRemaining or the iOS equivalent to get remaining time.