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
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-img2img";
const data = {
"prompt": "anime style",
"image": "toB64('https://segmind-sd-models.s3.amazonaws.com/display_images/flux-i2i-ip.png')",
"steps": 20,
"seed": 46588,
"denoise": 0.75,
"scheduler": "simple",
"sampler_name": "euler",
"base64": false
};
(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);
}
})();
Text prompt describing the desired image style
URL of the input image
Number of inference steps
min : 1,
max : 50
Seed for random number generation
Denoising strength
min : 0,
max : 1
Scheduler type
Allowed values:
Sampler name
Allowed values:
Output as base64 encoded string
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.
The Flux Image-To-Image model by Black Forest Labs is an advanced deep learning tool designed for transforming images based on specific textual prompts. This powerful model leverages a 12 billion parameter rectified flow transformer, enabling users to create detailed modifications and enhancements to their images.
Enhanced Image Quality: Generate stunning visuals at higher resolutions.
Advanced Human Anatomy and Photorealism: Achieve highly realistic and anatomically accurate images.
Improved Prompt Adherence: Get more accurate and relevant images based on your inputs.
Upload Image: Start by uploading the image you want to transform. The model supports PNG or JPG formats up to 2048 x 2048 pixels.
Input Text Prompt: Enter a descriptive prompt detailing the transformation or enhancements you want applied to the image.
Adjust Parameters: Fine-tune the model's various parameters to achieve the desired output.
Photo Editing: Enhance or completely transform photographs by integrating new elements and styles as described in textual prompts.
Artwork Refinement: Modify existing art pieces by adding or altering features based on descriptive inputs, aiding artists in iterative creation processes.
Marketing and Advertising: Generate multiple versions of product visuals or advertising content, catering to different themes and client requirements.
Creative Prototyping: Assist in the development stages of design projects, where existing images need iterative adjustments to match evolving concepts.