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/flux-controlnet";
const data = {
"base64": false,
"cn_stop": 0.5,
"cn_strength": 0.4,
"cn_type": "pose",
"custom_height": 1024,
"custom_width": 1024,
"guidance": 3.5,
"image": "toB64('https://segmind-sd-models.s3.amazonaws.com/display_images/model_1.png')",
"image_format": "jpeg",
"prompt": "Young woman in leather jacket and black mini skirt, busy city street, bokeh background, Kodak film, sunglasses on head, high quality photo, photorealistic, sharp focus, vibrant colors, urban fashion, street style, natural lighting, 35mm lens",
"quality": 95,
"sampler": "euler",
"samples": 1,
"scheduler": "simple",
"seed": 652889,
"steps": 20,
"use_input_img_dimension": true
};
(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);
}
})();
Output as base64 encoded string
ControlNet stop parameter
min : 0,
max : 1
ControlNet strength
min : 0,
max : 2
ControlNet type
Allowed values:
Custom height for output image
min : 64,
max : 4096
Custom width for output image
min : 64,
max : 4096
Guidance scale for the generation
min : 1,
max : 15
Input image
Output image format
Allowed values:
The prompt describing the image
Image quality setting for output
min : 10,
max : 100
Sampling method for image generation
Allowed values:
Number of samples to generate
min : 1,
max : 4
Scheduler for image generation
Allowed values:
Random seed for generation
Number of steps for generating the image
min : 15,
max : 75
Use input image dimensions for output image. Uncheck to specify custom height and custom width.
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.
Flux ControlNet is a cutting-edge collection of models designed to enhance image generation tasks by integrating ControlNet with the Flux.1 model. Developed by Black Forest Labs, these models offer unparalleled control over the output, making them a game-changer in the field of AI-driven image generation.
Flux ControlNet allows for precise control over image composition by adding extra conditions to the diffusion models. This integration supports multiple models, including Canny, Pose, and Depth & Tile.
Flux ControlNet leverages the power of ControlNet to provide additional input conditions, such as edge maps and depth maps, to guide the image generation process. This allows for more detailed and accurate outputs, tailored to specific requirements.
Canny ControlNet: Utilizes edge detection to define the structure of the generated image.
Pose ControlNet: Utilizes detection and extraction of human pose keypoints from images.
Depth ControlNet: Uses depth maps to add a sense of three-dimensionality to the images
Tile Controlnet: Leverages tiling techniques which ensures the creation of coherent, large-scale images with exceptional detail and consistency
Canny ControlNet isIdeal for generating comic book art with bold outlines and ink-like strokes, or highlighting building structures and edges in architectural visualizations.
Depth ControlNet is Well-suited for populating virtual reality environments with realistic textures or showcasing objects with accurate depth cues.
Openpose ControlNet is particularly useful for animating characters with precise poses in character animation or creating virtual fashion models for showcasing clothing in fashion design.
Tile ControlNet is Ideal for scenarios requiring expansive and detailed visual outputs.