POST
javascript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 const axios = require('axios'); const fs = require('fs'); const path = require('path'); async function toB64(imgPath) { const data = fs.readFileSync(path.resolve(imgPath)); return Buffer.from(data).toString('base64'); } const api_key = "YOUR API-KEY"; const url = "https://api.segmind.com/v1/expression-editor"; const data = { "aaa": 0, "blink": 0, "eee": 0, "eyebrow": 0, "image": "toB64('https://segmind-sd-models.s3.amazonaws.com/display_images/ep-editor-ip.png')", "image_format": "png", "image_quality": 95, "pupil_x": 0, "pupil_y": 0, "ref_expression_image": "toB64('null')", "rotate_pitch": 0, "rotate_roll": 0, "rotate_yaw": 0, "sample_parts": "OnlyExpression", "smile": 1, "wink": 0, "woo": 0 }; (async function() { try { const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } }); console.log(response.data); } catch (error) { console.error('Error:', error.response.data); } })();
RESPONSE
image/jpeg
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


aaafloat ( default: 1 )

Mouth shape for 'aaa'

min : -30,

max : 30


blinkfloat ( default: 1 )

Blink intensity

min : -20,

max : 5


eeefloat ( default: 1 )

Mouth shape for 'eee'

min : -15,

max : 15


eyebrowfloat ( default: 1 )

Eyebrow position adjustment

min : -10,

max : 10


imageimage *

URL of the Input Face Image


image_formatenum:str ( default: png )

Output image format

Allowed values:


image_qualityint ( default: 95 )

Image quality

min : 10,

max : 100


pupil_xfloat ( default: 1 )

Pupil X-axis position

min : -15,

max : 15


pupil_yfloat ( default: 1 )

Pupil Y-axis position

min : -15,

max : 15


ref_expression_imageimage ( default: 1 )

URL of the reference expression image


rotate_pitchfloat ( default: 1 )

Pitch rotation in degrees

min : -20,

max : 20


rotate_rollfloat ( default: 1 )

Roll rotation in degrees

min : -20,

max : 20


rotate_yawfloat ( default: 1 )

Yaw rotation in degrees

min : -20,

max : 20


sample_partsenum:str ( default: OnlyExpression )

Part of the face to sample

Allowed values:


smilefloat ( default: 1 )

Smile intensity

min : -0.3,

max : 1.3


winkfloat ( default: 1 )

Wink intensity

min : 0,

max : 25


woofloat ( default: 1 )

Mouth shape for 'woo'

min : -15,

max : 15

To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.

Expression Editor

The Expression Editor is an advanced AI model designed to transform facial expressions in images. By leveraging a reference image, this model can accurately generate a new image of a person with the same expression as seen in the reference. This tool is ideal for applications in digital art, animation, and social media content creation.

How to Use Expression Editor

  • Upload your image: Click the "Upload Image" button and select the image of the person you want to modify.

  • Upload reference image (Optional): Choose the reference image that demonstrates the desired expression. This is optional.

  • Click the "Generate" button. The model will process the images and create a new image with the person's face superimposed onto the reference image's expression. Use the advanced parameters to adjust the expression further if needed.

Adjust these parameters to achieve the perfect angle for your desired expression.

  1. Rotate: Adjust pitch, yaw, and roll for optimal positioning.

  2. Blink: Control the intensity of blinking.

  3. Eyebrow: Manipulate eyebrow position for natural-looking expressions.

  4. Wink: Create playful winks with adjustable intensity.

  5. Pupil: Position the pupils for added realism.

  6. Mouth: Shape your mouth for various expressions like "aaa," "eee," "woo," and smiles.

Begin with minor tweaks to see how each parameter affects the image. Gradually increase the adjustments to achieve the desired look.Combine different parameter adjustments to create more complex and nuanced expressions.

Use Cases

  • Artists can use the Expression Editor to create consistent facial expressions for characters in digital art and animations.

  • Easily generate reaction images and memes by changing expressions to fit different contexts.

  • Tailor marketing materials with personalized expressions to better connect with target audiences.

  • Enhance visual effects by adjusting actors’ expressions in post-production to achieve the desired emotional impact.