Face Beauty API
Banuba provides the Beauty API designed to help you integrate face modification and touch-up functionality into your app. The beautification features fit into a variety of use cases, i.e. live streaming, video chats and video conferencing apps to selfie editors and portrait retouching software. It aims to make the user feel comfortable about the camera experience.
tip
Read more about how to use and combine Makeup API and Face Beauty API features.
The Beauty module allows to enhance the face via the following built-in features:
Teeth Whitening
Allows for a beautiful smile.
Teeth.whitening(n)
- changes whitening texture intensity, where n - any value from 0 to 1 (including decimal).
- config.js
- Java
- Swift
- JavaScript
/* Feel free to add your custom code below */
// set teeth whitening strength
Teeth.whitening(1)
// Effect mCurrentEffect = ...
// set teeth whitening strength
mCurrentEffect.evalJs("Teeth.whitening(1)", null);
// var currentEffect: BNBEffect = ...
// set teeth whitening strength
currentEffect?.evalJs("Teeth.whitening(1)", resultCallback: nil)
// set teeth whitening strength
await effect.evalJs("Teeth.whitening(1)")
Preview
Face morphing
Slims down the cheeks and nose to make it more delicate.
FaceMorph.eyes(n)
- set eyes enlarge strengthFaceMorph.face(n)
- set checks slim down strengthFaceMorph.nose(n)
- set nose slim down strengthFaceMorph.lips(n)
- set lips enlarge strengthFaceMorph.clear()
- resets morph
- config.js
- Java
- Swift
- JavaScript
/* Feel free to add your custom code below */
FaceMorph.eyes(0.6)
FaceMorph.face(0.5)
FaceMorph.nose(1)
FaceMorph.lips(1)
// FaceMorph.clear()
// Effect mCurrentEffect = ...
mCurrentEffect.evalJs("FaceMorph.eyes(0.6)", null);
mCurrentEffect.evalJs("FaceMorph.face(0.5)", null);
mCurrentEffect.evalJs("FaceMorph.nose(1)", null);
mCurrentEffect.evalJs("FaceMorph.lips(1)", null);
// mCurrentEffect.evalJs("FaceMorph.clear()", null);
// var currentEffect: BNBEffect = ...
currentEffect?.evalJs("FaceMorph.eyes(0.6)", resultCallback: nil)
currentEffect?.evalJs("FaceMorph.face(0.5)", resultCallback: nil)
currentEffect?.evalJs("FaceMorph.nose(1)", resultCallback: nil)
currentEffect?.evalJs("FaceMorph.lips(1)", resultCallback: nil)
// currentEffect?.evalJs("FaceMorph.clear()", resultCallback: nil)
await effect.evalJs("FaceMorph.eyes(0.6)")
await effect.evalJs("FaceMorph.face(0.5)")
await effect.evalJs("FaceMorph.nose(1)")
await effect.evalJs("FaceMorph.lips(1)")
// await effect.evalJs("FaceMorph.clear()")
Preview
Photo filters (LUT)
Applies color filters to the entire image.
Filter.set("lut_texture.png")
- set lut filter texture,Filter.strength(n)
- set lut filter strength, where n - any value from 0 to 1 (including decimal), but also larger values may be passed, like 2, 3, etc;Filter.clear()
- clears filter.
- config.js
- Java
- Swift
- JavaScript
/* Feel free to add your custom code below */
Filter.set("lut_texture.png")
Filter.strength(1)
Filter.clear()
// Effect mCurrentEffect = ...
mCurrentEffect.evalJs("Filter.set('lut_texture.png')", null);
mCurrentEffect.evalJs("Filter.strength(1)", null);
mCurrentEffect.evalJs("Filter.clear()", null);
// var currentEffect: BNBEffect = ...
currentEffect?.evalJs("Filter.set('lut_texture.png')", resultCallback: nil)
currentEffect?.evalJs("Filter.strength(1)", resultCallback: nil)
currentEffect?.evalJs("Filter.clear()", resultCallback: nil)
await effect.evalJs("Filter.set('lut_texture.png')")
await effect.evalJs("Filter.strength(1)")
await effect.evalJs("Filter.clear()")
Preview
Skin
Skin smoothing (Skin softening)
Makes the skin look younger by smoothing wrinkles.
Skin.softening(n)
- set softening intensity, where n - any value from 0 to 1 (including decimal).
- config.js
- Java
- Swift
- JavaScript
/* Feel free to add your custom code below */
Skin.softening(1)
// Effect mCurrentEffect = ...
mCurrentEffect.evalJs("Skin.softening(1)", null);
// var currentEffect: BNBEffect = ...
currentEffect?.evalJs("Skin.softening(1)", resultCallback: nil)
await effect.evalJs("Skin.softening(1)")
Preview
Skin color
Changes the face and neck skin color.
Skin.color("R G B A")
- set skin color in R G B A format (separated with space). Each value should be in a rage from 0 to 1 (including decimal),Skin.clear()
- clears skin color and softening.
info
Requires Skin segmentation Neural Network.
- config.js
- Java
- Swift
- JavaScript
/* Feel free to add your custom code below */
Skin.color("0.8 0.6 0.1 0.4")
Skin.clear()
// Effect mCurrentEffect = ...
mCurrentEffect.evalJs("Skin.color('0.8 0.6 0.1 0.4')", null);
mCurrentEffect.evalJs("Skin.clear()", null);
// var currentEffect: BNBEffect = ...
currentEffect?.evalJs("Skin.color('0.8 0.6 0.1 0.4')", resultCallback: nil)
currentEffect?.evalJs("Skin.clear()", resultCallback: nil)
await effect.evalJs("Skin.color('0.8 0.6 0.1 0.4')")
await effect.evalJs("Skin.clear()")
Preview
Background separation
info
Requires Background separation Neural Network.
Background texture
Sets the file as background texture.
Background.texture("bg_image.png")
- sets an image-file as a background texture.- Supported formats:
.jpeg
,.jpg
,.png
,.ktx
,.gif
.
- Supported formats:
Background.texture("bg_video.mp4")
- sets the video file as a background texture. Visit technical specification for supported video-formats.
- config.js
- Java
- Swift
- JavaScript
/* Feel free to add your custom code below */
Background.texture("bg_colors_tile.png")
// Effect mCurrentEffect = ...
mCurrentEffect.evalJs("Background.texture('bg_colors_tile.png')", null);
// var currentEffect: BNBEffect = ...
currentEffect?.evalJs("Background.texture('bg_colors_tile.png')", resultCallback: nil)
await effect.evalJs("Background.texture('bg_colors_tile.png')")
Preview
Background transparency
Sets the background transparency.
Background.transparency(n)
- set transperany value from 0 to 1 (including decimal).
- config.js
- Java
- Swift
- JavaScript
/* Feel free to add your custom code below */
Background.transparency(0.5)
// Effect mCurrentEffect = ...
mCurrentEffect.evalJs("Background.transparency(0.5)", null);
// var currentEffect: BNBEffect = ...
currentEffect?.evalJs("Background.transparency(0.5)", resultCallback: nil)
await effect.evalJs("Background.transparency(0.5)")
Preview
Background rotation
Rotates the background texture clockwise in degrees.
Background.rotation(deg)
- set rotation value from 0 360 degrees. Value should be divisible by 90 degrees.
- config.js
- Java
- Swift
- JavaScript
/* Feel free to add your custom code below */
Background.rotation(90)
// Effect mCurrentEffect = ...
mCurrentEffect.evalJs("Background.rotation(90)", null);
// var currentEffect: BNBEffect = ...
currentEffect?.evalJs("Background.rotation(90)", resultCallback: nil)
await effect.evalJs("Background.rotation(90)")
Background scale
Scales the background texture.
Background.scale(n)
- multiplies the background texture size on given value.
- config.js
- Java
- Swift
- JavaScript
/* Feel free to add your custom code below */
Background.scale(2)
// Effect mCurrentEffect = ...
mCurrentEffect.evalJs("Background.scale(2)", null);
// var currentEffect: BNBEffect = ...
currentEffect?.evalJs("Background.scale(2)", resultCallback: nil)
await effect.evalJs("Background.scale(2)")
Background contentMode
Sets the background texture content mode.
Background.contentMode("mode")
- set mode type, possible values:fill
,fit
,scale_to_fill
.
- config.js
- Java
- Swift
- JavaScript
/* Feel free to add your custom code below */
Background.contentMode("fill")
// Effect mCurrentEffect = ...
mCurrentEffect.evalJs("Background.contentMode('fill')", null);
// var currentEffect: BNBEffect = ...
currentEffect?.evalJs("Background.contentMode('fill')", resultCallback: nil)
await effect.evalJs("Background.contentMode('fill')")
Background blur
Blurs background behind the user.
Background.blur(n)
- sets the background blur radius in [0, 1] range.
- config.js
- Java
- Swift
- JavaScript
/* Feel free to add your custom code below */
Background.blur(0.2)
// Effect mCurrentEffect = ...
mCurrentEffect.evalJs("Background.blur(0.2)", null);
// var currentEffect: BNBEffect = ...
currentEffect?.evalJs("Background.blur(0.2)", resultCallback: nil)
await effect.evalJs("Background.blur(0.2)")
Preview
Background clear
Removes the background color and texture, resets any settings applied.
- config.js
- Java
- Swift
- JavaScript
/* Feel free to add your custom code below */
Background.clear()
// Effect mCurrentEffect = ...
mCurrentEffect.evalJs("Background.clear()", null);
// var currentEffect: BNBEffect = ...
currentEffect?.evalJs("Background.clear()", resultCallback: nil)
await effect.evalJs("Background.clear()")
Hair coloring
info
Requires Hair segmentation Neural Network.
Single color
Colors hair with one color.
Hair.color("R G B A")
- set hair color in R G B A format (separated with space). Each value should be in a rage from 0 to 1 (including decimal),Hair.clear()
- clears hair color (including gradient and hair strands).
- config.js
- Java
- Swift
- JavaScript
/* Feel free to add your custom code below */
Hair.color("0.39 0.14 0.14 0.8")
Hair.clear()
// Effect mCurrentEffect = ...
mCurrentEffect.evalJs("Hair.color('0.39 0.14 0.14 0.8')", null);
mCurrentEffect.evalJs("Hair.clear()", null);
// var currentEffect: BNBEffect = ...
currentEffect?.evalJs("Hair.color('0.39 0.14 0.14 0.8')", resultCallback: nil
currentEffect?.evalJs("Hair.clear()", resultCallback: nil)
await effect.evalJs("Hair.color('0.39 0.14 0.14 0.8')")
await effect.evalJs("Hair.clear()")
Preview
Hair gradient
Colors hair with 1 to 5 colors.
Hair.color("start_color_rgba", "end_color_rgba")
- set hair gradient in R G B A format (separated with space). Each rgba value should be in a rage from 0 to 1 (including decimal),
- config.js
- Java
- Swift
- JavaScript
/* Feel free to add your custom code below */
Hair.color("0.19 0.06 0.25", "0.09 0.25 0.38")
// Effect mCurrentEffect = ...
mCurrentEffect.evalJs("Hair.color('0.19 0.06 0.25', '0.09 0.25 0.38')", null);
// var currentEffect: BNBEffect = ...
currentEffect?.evalJs("Hair.color('0.19 0.06 0.25', '0.09 0.25 0.38')", resultCallback: nil)
await effect.evalJs("Hair.color('0.19 0.06 0.25', '0.09 0.25 0.38')")
Preview
Hair strands painting
Colors hair strands with 1 to 5 colors.
Hair.strands("R G B A", "R G B A", "R G B A", ...)
- set hair strands in R G B A format (separated with space) with 5 color maximum.
info
Requires Hair strands painting Add-On.
- config.js
- Java
- Swift
- JavaScript
/* Feel free to add your custom code below */
Hair.strands("0.80 0.40 0.40 1.0", "0.83 0.40 0.40 1.0", "0.85 0.75 0.75 1.0", "0.87 0.60 0.60 1.0", "0.99 0.65 0.65 1.0")
// Effect mCurrentEffect = ...
mCurrentEffect.evalJs("Hair.strands('0.80 0.40 0.40 1.0', '0.83 0.40 0.40 1.0', '0.85 0.75 0.75 1.0', '0.87 0.60 0.60 1.0', '0.99 0.65 0.65 1.0')", null);
// var currentEffect: BNBEffect = ...
currentEffect?.evalJs("Hair.strands('0.80 0.40 0.40 1.0', '0.83 0.40 0.40 1.0', '0.85 0.75 0.75 1.0', '0.87 0.60 0.60 1.0', '0.99 0.65 0.65 1.0')", resultCallback: nil);
await effect.evalJs("Hair.strands('0.80 0.40 0.40 1.0', '0.83 0.40 0.40 1.0', '0.85 0.75 0.75 1.0', '0.87 0.60 0.60 1.0', '0.99 0.65 0.65 1.0')")
Preview
Eyes beautification
info
Requires Eye segmentation Neural Network.
Eyes coloring
Changes the color of the iris as in virtual lens try on.
Eyes.color("R G B A")
- set eyes color in R G B A format (separated with space). Each value should be in a rage from 0 to 1 (including decimal),Eyes.clear()
- clears eyes color including flare and whitening.
- config.js
- Java
- Swift
- JavaScript
/* Feel free to add your custom code below */
Eyes.color("0 0.2 0.8 0.64")
Eyes.clear()
// Effect mCurrentEffect = ...
mCurrentEffect.evalJs("Eyes.color('0 0.2 0.8 0.64')", null);
mCurrentEffect.evalJs("Eyes.clear()", null);
// var currentEffect: BNBEffect = ...
currentEffect?.evalJs("Eyes.color('0 0.2 0.8 0.64')", resultCallback: nil)
currentEffect?.evalJs("Eyes.clear()", resultCallback: nil)
await effect.evalJs("Eyes.color('0 0.2 0.8 0.64')")
await effect.evalJs("Eyes.clear()")
Preview
Eye flare
Makes eyes more expressive adding flare.
Eyes.flare(n)
- sets the eyes flare strength from 0 to 1.
- config.js
- Java
- Swift
- JavaScript
/* Feel free to add your custom code below */
Eyes.flare("1")
// Effect mCurrentEffect = ...
mCurrentEffect.evalJs("Eyes.flare(1)", null);
// var currentEffect: BNBEffect = ...
currentEffect?.evalJs("Eyes.flare(1)", resultCallback: nil)
await effect.evalJs("Eyes.flare(1)")
Preview
Eyes whitening
Makes the look more expressive by whitening eyes.
Eyes.whitening(n)
- sets the eyes sclera whitening strength from 0 to 1.
- config.js
- Java
- Swift
- JavaScript
/* Feel free to add your custom code below */
Eyes.whitening(1)
// Effect mCurrentEffect = ...
mCurrentEffect.evalJs("Eyes.whitening(1)", null);
// var currentEffect: BNBEffect = ...
currentEffect?.evalJs("Eyes.whitening(1)", resultCallback: nil)
await effect.evalJs("Eyes.whitening(1)")
Preview
Eye bags removal
Removes eye bags. Works in offline mode only (for photo or video processing).
info
Requires Eye bags removal Add-On.
EyeBagsRemoval.enable()
- enables eye bags removal,EyeBagsRemoval.disable()
- disables eye bags removal.
- config.js
- Java
- Swift
/* Feel free to add your custom code below */
EyeBagsRemoval.enable()
EyeBagsRemoval.disable()
// Effect mCurrentEffect = ...
mCurrentEffect.evalJs("EyeBagsRemoval.enable()", null);
mCurrentEffect.evalJs("EyeBagsRemoval.disable()", null);
// var currentEffect: BNBEffect = ...
currentEffect?.evalJs("EyeBagsRemoval.enable()", resultCallback: nil)
currentEffect?.evalJs("EyeBagsRemoval.disable()", resultCallback: nil)
Preview