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 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-inpaint"; const data = { "base64": false, "guidance_scale": 3.5, "image": "toB64('https://segmind-sd-models.s3.amazonaws.com/display_images/flux-inapint-ip.jpg')", "image_format": "jpeg", "mask": "toB64('https://segmind-sd-models.s3.amazonaws.com/display_images/flux-inpaint-mask.jpeg')", "negative_prompt": "bad quality, painting, blur", "num_inference_steps": 25, "prompt": "huge ship sailing", "quality": 95, "sampler": "euler", "samples": 1, "scheduler": "simple", "seed": 12467, "strength": 0.9 }; (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); } })();
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


base64bool ( default: 1 )

Output as base64 encoded string


guidance_scalefloat ( default: 3.5 )

Guidance scale for the generation

min : 1,

max : 10


imageimage *

Input image


image_formatenum:str ( default: jpeg )

Output image format

Allowed values:


maskimage *

Mask image


negative_promptstr ( default: bad quality, painting, blur )

Description of what to avoid in the image


num_inference_stepsint ( default: 25 )

Number of inference steps

min : 10,

max : 75


promptstr *

Description of the image to be generated


qualityint ( default: 95 )

Image quality setting for output

min : 10,

max : 100


samplerenum:str ( default: euler )

Sampling method for image generation

Allowed values:


samplesint ( default: 1 )

Number of samples to generate

min : 1,

max : 4


schedulerenum:str ( default: simple )

Scheduler for image generation

Allowed values:


seedint ( default: 12467 )

Random seed for generation


strengthfloat ( default: 0.9 )

Strength of the effect applied

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.

Flux Inpainting

Flux Inpainting allows you to selectively edit and enhance images. Whether you’re restoring old photographs, removing unwanted objects, or filling in missing regions.

Key Features of Flux Inpainting

  • High-Quality Inpainting: Flux Inpainting excels in maintaining the visual integrity of images. It uses sophisticated algorithms to analyze the surrounding pixels and generate content that matches the original texture and color.

  • User-Friendly Interface: The tool is designed with ease of use in mind, making it accessible for both professionals and beginners. The intuitive interface allows users to quickly select areas for inpainting and apply changes with minimal effort.

  • Versatile Applications: Whether you need to remove unwanted objects, repair old photos, or enhance digital artwork, Flux Inpainting provides versatile solutions for a wide range of image editing needs.

How to Use Flux Inpainting

  • Upload Your Image: Start by uploading the image you want to edit.

  • Select the Area to Inpaint: Use the inpaint brush to highlight the area of the image that needs inpainting.

  • Apply Inpainting: Click the generate button to let the AI work its magic. The model will analyze the surrounding pixels and generate a seamless fill for the selected area. Once the inpainting process is complete, review the changes and save the edited image to your device.

Use cases

  • Repairing Damaged Photos: Flux Inpainting can restore old or damaged photographs by filling in missing or deteriorated parts, bringing them back to their original glory. It can also effectively remove scratches, blemishes, and other imperfections from photos, making them look as good as new.

  • Artistic Enhancements: Artists and designers can use Flux Inpainting to add or modify elements in their artwork, enhancing creativity and visual appeal.

  • Unwanted Objects: Whether it’s an unwanted object in the background or an object that disrupts the composition, Flux Inpainting can seamlessly remove these elements from images.

Flux Inpainting is a powerful tool that brings advanced image editing capabilities to users of all skill levels. Its combination of high-quality results, user-friendly interface, and fast processing times make it an essential tool for anyone looking to enhance their images effortlessly.