1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const axios = require('axios');
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/bria-blur-background";
const data = {
"image": "https://segmind-resources.s3.amazonaws.com/input/d8806bf3-26b3-4fa7-bf06-818b4eb3494b-7f1198b9-2961-4dc1-ad67-e9c60013b44a.jpeg",
"scale": 5,
"preserve_alpha": true,
"visual_input_content_moderation": false,
"visual_output_content_moderation": 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);
}
})();
Input an image URL for processing. Use clear, high-resolution images for best results.
Set blur intensity from 1 to 5. Use 3 for moderate background blur.
min : 1,
max : 5
Retains transparency if enabled. Useful for logos and overlays.
Enables moderation to filter input. Activate for sensitive operations.
Ensures moderated output. Enable for compliance requirements.
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.
Bria AI’s Image Editing API v2 is a suite of generative image-manipulation models built for developers, creators, and product managers. It supports precise object removal, content-aware fills, background editing, canvas expansion, detail enhancement, and resolution upscaling. Leveraging advanced diffusion and transformer architectures, Bria AI v2 produces context-aware edits while preserving original image quality. With built-in moderation controls, it’s designed for safe, scalable integration into web, mobile, and desktop applications.
scale
parameter (1–5) to control blur intensity in background edits. Default is 3
for balanced blurring.preserve_alpha
for logos or overlays to maintain alpha channels.visual_input_content_moderation
or visual_output_content_moderation
when handling sensitive imagery.Q: How do I remove an object from an image?
A: Use the Eraser model with a binary mask over the target area. The API will seamlessly fill the removed region based on surrounding context.
Q: Can I replace or blur a background automatically?
A: Yes. Invoke the background editing endpoint, set scale
(1–5) for blur, or pass a replacement image/prompt for dynamic backgrounds.
Q: What is Generative Fill and how do I use it?
A: Generative Fill regenerates masked regions via text prompts. Supply a mask and descriptive prompt (e.g., “add a sunset over the lake”) to create new content.
Q: How can I upscale images without artifacts?
A: Call Increase Resolution after Enhance Image. The upscaler preserves edges and textures without fabricating new elements.
Q: How do I maintain transparency in output?
A: Enable preserve_alpha=true
. This retains the original alpha channel, ideal for overlays, watermarks, and UI assets.