Beauty and makeup features must be enabled for your Nosmai project before you can use these APIs. Review your project's enabled features in Nosmai Console.
Prerequisites
- A working React Native quickstart
NosmaiCameraViewhas firedonReady
Available beauty and makeup features
Nosmai Effects provides controls for skin enhancement, virtual makeup, facial reshaping, eye and hair adjustments, and color correction.
Skin enhancement
- Skin smoothing
- Skin whitening
- Teeth whitening
- Sharpening
- Contour and highlighter
- Freckles
- Foundation
- Dark-circle correction
Virtual makeup
- Lipstick
- Blush
- Eyeshadow
- Eyelashes
- Eyebrows
Facial reshaping
- Face slimming
- Eye enlargement
- Nose reshaping
- Jaw reshaping
- Chin reshaping
- Lip size adjustment
- Eyebrow position adjustment
- Eyebrow thickness adjustment
- Mouth width adjustment
- Forehead size adjustment
Eye and hair adjustments
- Eye color
- Hair color
Color adjustments
- Brightness
- Contrast
- Hue
- Saturation through HSB adjustment
- RGB adjustment
- White balance
- Grayscale
These features require beauty and makeup access to be enabled for your Nosmai project. Review your project's enabled features in Nosmai Console.
Apply a subtle preset
const prepared = await NosmaiCameraSdk.prepareBeautyFilters();
if (!prepared) {
throw new Error('Beauty filters are not ready');
}
await NosmaiCameraSdk.setSkinSmoothing(0.35);
await NosmaiCameraSdk.setSkinWhitening(0.15);
await NosmaiCameraSdk.setTeethWhitening(0.20);
await NosmaiCameraSdk.setSharpening(0.15);
Run this sequence after NosmaiCameraView.onReady. Preparation does not enable an effect; it prepares shared native beauty resources before the first control change.
Add complexion controls
await NosmaiCameraSdk.applyContourHighlighter({
contour: 0.35,
highlighter: 0.20,
});
await NosmaiCameraSdk.applyFreckles(0.25);
await NosmaiCameraSdk.applyFoundation({
shade: 'honey',
coverage: 0.30,
});
await NosmaiCameraSdk.applyDarkCircleCorrector(0.25);
Makeup styles and palettes
Use applyMakeup after the preview is ready and beauty preparation succeeds. Its configuration identifies one makeup layer and a style supported by that layer:
type | Supported style values | Strength |
|---|---|---|
lipstick | classic, matte, natural | 0...2 |
eyeshadow | smokey, shimmer, natural | 0...1 |
blusher | round, contour, natural | 0...2 |
eyelash | natural, dramatic, wispy | 0...1 |
eyebrow | natural, bold, arched | 0...1 |
0 makes a layer invisible. Lipstick and blush use 1 as standard strength and accept stronger values up to 2. Clamp slider input before calling the SDK; unsupported styles and out-of-range values reject the Promise.
Apply styles and custom shades
Custom colours use normalized red, green, and blue components from 0 to 1. Omitting color uses the native default shade for the style. Eyelashes use their style and strength without a colour.
await NosmaiCameraSdk.applyMakeup({
type: 'lipstick',
style: 'matte',
color: { red: 0.72, green: 0.08, blue: 0.12 },
intensity: 0.65,
});
await NosmaiCameraSdk.applyMakeup({
type: 'eyeshadow',
style: 'smokey',
color: { red: 0.30, green: 0.20, blue: 0.16 },
intensity: 0.35,
});
await NosmaiCameraSdk.applyMakeup({
type: 'blusher',
style: 'natural',
color: { red: 0.85, green: 0.38, blue: 0.42 },
intensity: 0.30,
});
await NosmaiCameraSdk.applyMakeup({
type: 'eyelash',
style: 'wispy',
intensity: 0.50,
});
await NosmaiCameraSdk.applyMakeup({
type: 'eyebrow',
style: 'natural',
color: { red: 0.22, green: 0.14, blue: 0.10 },
intensity: 0.40,
});
Await the calls in order and handle rejections before updating selected UI state. A colour's alpha component does not control makeup strength; use intensity.
Select a palette shade
Palette getters return NosmaiMakeupColor items containing name and normalized colour components:
const palette = await NosmaiCameraSdk.getLipstickColors();
const shade = palette[0];
if (shade) {
await NosmaiCameraSdk.applyMakeup({
type: 'lipstick',
style: 'matte',
color: shade,
intensity: 0.65,
});
}
The other getters are getEyeshadowColors(), getBlusherColors(), and getEyebrowColors(). Query the appropriate palette rather than assuming a fixed count or shared order across layers and platforms. Applications can also supply their own normalized RGB swatches.
Update or remove a layer
Update strength without reapplying its style or colour:
await NosmaiCameraSdk.setMakeupIntensity('lipstick', 0.80);
if (await NosmaiCameraSdk.isMakeupActive('lipstick')) {
await NosmaiCameraSdk.removeMakeup('lipstick');
}
These methods accept the same five type values listed above. Use await NosmaiCameraSdk.clearMakeup() to remove the makeup layers together. Built-in makeup can replace an authored AR look; follow the active visual-mode rules when switching between manual makeup and a package.
Face reshaping
Call NosmaiCameraSdk.setReshape(type, value) after NosmaiCameraView.onReady and successful beauty preparation. type is a NosmaiReshapeType string; use the following supported values rather than native integer IDs:
| Control | type | Positive direction |
|---|---|---|
| Lip size | lip | Fuller lips |
| Face slimming | faceSlim | Slimmer face |
| Eye size | eye | Larger eyes |
| Nose size | nose | Smaller nose |
| Chin | chin | More tucked chin |
| Eyebrow position | brow | Higher eyebrows |
| Eyebrow thickness | browThickness | Thicker eyebrows |
| Jaw width | jaw | Narrower jaw |
| Mouth width | mouthWidth | Wider mouth |
| Forehead size | forehead | Taller forehead |
Values must be finite numbers from -1 to 1. 0 is neutral, and negative values apply the opposite direction. Unsupported types, non-finite numbers, and out-of-range values reject the Promise. Native controls have individual limits, so equal strengths need not produce equal visible displacement.
Apply and reset shape controls
await NosmaiCameraSdk.setReshape('faceSlim', 0.20);
await NosmaiCameraSdk.setReshape('eye', 0.15);
await NosmaiCameraSdk.setReshape('brow', -0.10);
Multiple controls can remain active together. Convert a -100%...100% UI value by dividing by 100, then clamp it to -1...1 before calling the SDK. Do not pass -100 or 100 directly.
Update only the changed control and handle rejections. Coalesce rapid slider events so stale updates do not build up, and ignore UI updates after the camera screen unmounts. Keep selected values in app state and reapply them when a replacement preview fires onReady.
Reset one control to neutral, or clear all unified shape controls:
await NosmaiCameraSdk.setReshape('eye', 0);
await NosmaiCameraSdk.clearReshaping();
clearReshaping() is the targeted shape reset; it is not a request to remove makeup, skin enhancement, packages, or backgrounds.
Use these typed JavaScript APIs instead of copying native methods such as applyFaceSlimming or native type IDs. Reshaping requires a tracked face and enabled Beauty Effects. It can be used with built-in skin enhancement and makeup; manual beauty can replace an authored AR look. A fulfilled Promise does not establish whether a face is currently tracked.
Eye and hair colouring
Call these controls after onReady and successful beauty preparation. Colours use normalized red, green, and blue components from 0 to 1, not 0...255. Intensity must be finite and within 0...1; invalid values reject the Promise.
Apply colours and update intensity
await NosmaiCameraSdk.setEyeColor(
{ red: 0.20, green: 0.45, blue: 0.75 },
0.50,
);
await NosmaiCameraSdk.setHairColor(
{ red: 0.70, green: 0.35, blue: 0.20 },
0.60,
);
await NosmaiCameraSdk.setEyeColorIntensity(0.65);
await NosmaiCameraSdk.setHairColorIntensity(0.45);
Eye colour requires a tracked face and targets the iris/contact-lens area, not the whites of the eyes. Hair colour uses segmentation and may need a short warm-up. Update the intensity setter during slider changes without remounting the camera or repeatedly toggling the layer.
Inspect and remove colour layers
const eyeEnabled = await NosmaiCameraSdk.isEyeColorActive(); const hairEnabled = await NosmaiCameraSdk.isHairColorActive(); if (eyeEnabled) await NosmaiCameraSdk.removeEyeColor(); if (hairEnabled) await NosmaiCameraSdk.removeHairColor();
These queries describe configured layers, not whether a face or hair region was detected in the current frame. A zero intensity hides the blend; use the remove method to disable an unused layer. Hair segmentation adds processing load, so qualify different hair colours, lighting, and motion on target devices. Preserve selections in app state and reapply them after a new preview fires onReady.
Parameter ranges
Standard strengths use 0 through 1, with 0 as the disabled value. Contour, highlighter, lipstick, and blush use 0 through 2, where 1 is normal strength. Eyeshadow, eyelashes, and eyebrows use 0 through 1. Signed reshape controls use -1 through 1, with 0 as neutral. Clamp slider input before calling the TurboModule and ignore a completed Promise if the camera screen has already unmounted.
Reset beauty
await NosmaiCameraSdk.clearBeauty();
clearBeauty() clears skin beauty, makeup, reshaping, and eye color. It preserves color controls, package slots, and manual backgrounds.
Verify it worked
Change smoothing from 0 to 0.35 while the camera view remains mounted. The native preview should update without a React component remount.
Apply a palette shade, change its intensity, then remove the individual layer. Verify that the selected style and colour stay unchanged during slider updates.
Test one reshape type at 0, a small positive value, and a small negative value. Reset it before testing the next type. Check Android, iOS, front and rear cameras, and confirm clearReshaping() restores the original face shape.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
| Promise rejects before preview appears | Processing has not started | Await initialization, mount the view, wait for onReady, then prepare beauty |
| Changes are lost after Fast Refresh | Native state and JavaScript lifecycle were reset differently | Run full cleanup and reopen the screen during development |
| Preview performance falls | Development tooling or multiple face features add load | Verify a Release build on a physical device |
| Makeup configuration rejects | The selected style belongs to another layer or the intensity is out of range | Use the layer's supported style values and clamp the intensity before calling |
| A shade looks incorrect | RGB values use 0...255 instead of 0...1 | Divide RGB values by 255 or use a returned palette colour |
| A reshape update rejects | The type is unsupported, or a UI percentage was passed directly | Use a listed type string and a finite -1...1 value |
| A shape changes in the wrong direction | A signed value or mirrored UI label is interpreted incorrectly | Test the control alone around 0 and use the table's positive direction |