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
const axios = require('axios');
const FormData = require('form-data');
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/style-transfer";
const reqBody = {
"model": "fast",
"width": 1024,
"height": 1024,
"prompt": "A panda running on a jogging track",
"style_image": "https://segmind-inference-io.s3.amazonaws.com/sample_images/40548cb9-ae1f-4caa-969d-382c913a74ef.webp",
"output_format": "webp",
"output_quality": 80,
"number_of_images": 1,
"structure_depth_strength": 1,
"structure_denoising_strength": 0.65
};
(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);
}
})();
Set a seed for reproducibility. Random by default.
An enumeration.
Allowed values:
Width of the output image (ignored if structure image given)
Height of the output image (ignored if structure image given)
Prompt for the image
Copy the style from this image
An enumeration.
Allowed values:
Quality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality.
min : 0,
max : 100
Things you do not want to see in your image
An optional image to copy structure from. Output images will use the same aspect ratio.
Number of images to generate
min : 1,
max : 10
Strength of the depth controlnet
min : 0,
max : 2
How much of the original image (and colors) to preserve (0 is all, 1 is none, 0.65 is a good balance)
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.
IPAdapter with Style Transfer revolutionizes image editing by seamlessly combining the functionality of IPAdapter with advanced style transfer techniques. This approach enables users to effortlessly apply artistic styles to their images while preserving the original content. Whether you want to transform a photo into a painting or give it a unique artistic flair, IPAdapter with Style Transfer provides the tools to make your creative vision a reality. The result is a blend of sophisticated technology and artistic expression, allowing for stunning visual transformations.