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 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); } })();
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: 1 )

Set a seed for reproducibility. Random by default.


modelenum:str ( default: fast )

An enumeration.

Allowed values:


widthint ( default: 1024 )

Width of the output image (ignored if structure image given)


heightint ( default: 1024 )

Height of the output image (ignored if structure image given)


promptstr ( default: A panda running on a jogging track )

Prompt for the image


style_imagestr *

Copy the style from this image


output_formatenum:str ( default: webp )

An enumeration.

Allowed values:


output_qualityint ( default: 80 )

Quality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality.

min : 0,

max : 100


negative_promptstr ( default: 1 )

Things you do not want to see in your image


structure_imagestr ( default: 1 )

An optional image to copy structure from. Output images will use the same aspect ratio.


number_of_imagesint ( default: 1 )

Number of images to generate

min : 1,

max : 10


structure_depth_strengthfloat ( default: 1 )

Strength of the depth controlnet

min : 0,

max : 2


structure_denoising_strengthfloat ( default: 0.65 )

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.

Style Transfer

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.

Know more about IPAdapter Style Transfer here.