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 42 43 44 45 46 47 const axios = require('axios'); const FormData = require('form-data'); const api_key = "YOUR API-KEY"; const url = "https://api.segmind.com/v1/face-to-sticker"; const reqBody = { "seed": 411, "image": "https://segmind-sd-models.s3.amazonaws.com/display_images/face-to-sticker-input.jpg", "steps": 20, "width": 1024, "height": 1024, "prompt": "a person", "upscale": false, "upscale_steps": 10, "prompt_strength": 7, "ip_adapter_noise": 0.5, "ip_adapter_weight": 0.2, "instant_id_strength": 1 }; (async function() { try { const formData = new FormData(); // Append regular fields for (const key in reqBody) { if (reqBody.hasOwnProperty(key)) { formData.append(key, reqBody[key]); } } // Convert and append images as Base64 if necessary const response = await axios.post(url, formData, { headers: { 'x-api-key': api_key, ...formData.getHeaders() } }); console.log(response.data); } catch (error) { console.error('Error:', error.response ? error.response.data : error.message); } })();
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


seedint ( default: 321312 )

Fix the random seed for reproducibility


imagestr ( default: https://segmind-sd-models.s3.amazonaws.com/display_images/face-to-sticker-input.jpg )

An image of a person to be converted to a sticker


stepsint ( default: 20 )


widthint ( default: 1024 )


heightint ( default: 1024 )


promptstr ( default: a person )


upscalebool ( default: 1 )

2x upscale the sticker


upscale_stepsint ( default: 10 )

Number of steps to upscale


negative_promptstr ( default: 1 )

Things you do not want in the image


prompt_strengthfloat ( default: 7 )

Strength of the prompt. This is the CFG scale, higher numbers lead to stronger prompt, lower numbers will keep more of a likeness to the original.


ip_adapter_noisefloat ( default: 0.5 )

How much noise is added to the IP adapter input

min : 0,

max : 1


ip_adapter_weightfloat ( default: 0.2 )

How much the IP adapter will influence the image

min : 0,

max : 1


instant_id_strengthfloat ( default: 1 )

How strong the InstantID will be.

min : 0,

max : 1

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.

Face to Sticker

Face to sticker model takes an image of a person and creates a sticker image. This is based on style transfer, where essentially the sticker style is created for an input image of a person. The output is a new image that looks like a sticker but retains the facial features of the person in the input image. This model helps in the creation of personalized stickers from just about any image of a person.

Key Components of Face to Sticker

Under the hood of Face to sticker model is a combination of Instant ID + IP Adapter + ControlNet Depth + Background removal.

  1. Instant ID is responsible for identifying the unique features of the face of the person in the input image.

  2. An image encoder (IP Adapter) helps in transferring the sticker style on to the face image of the person in the input image.

  3. ControlNet Depth estimates the depth of different parts of the face. This helps in creating a 3D representation of the face, which can then be used to apply the sticker style in a way that looks natural and realistic.

  4. Background Removal removes the background, resulting in a clean sticker image.

How to use Face to Sticker

  1. Input image: Choose an image that you want to transform into a sticker. A close-up portrait shot is ideal because it allows the model to clearly identify and process the facial features.

  2. Prompt: Provide a text prompt based on the input image. This could be a simple description of the person in the image, such as “a man” etc. The model uses this prompt to guide the style transfer process.

  3. Parameters: Adjust the below parameters to guide the final image output.

    a. Prompt Strength: This parameter is similar to the CGF scale. It determines how closely the image generation follows the text prompt. A higher value will result in an output image that more closely matches the prompt.

    b. IP Adapter Noise: This parameter determines the degree of influence of the sticker style. A higher value will result in a more stylized output image

    c. IP Adapter Strength: This parameter determines the weight of influence of the sticker style. A higher value will result in a stronger application of the sticker style to the output image.

    d. Instant ID strength: This parameter determines how closely the output image resembles the person in the input image. A higher value will result in an output image that more closely resembles the input image.