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
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/smart-banner-resizer";
const data = {
"image_url": "toB64('https://segmind-resources.s3.amazonaws.com/input/smart-banner-resizer-input.png')",
"target_sizes": [
"1080x1080",
"1080x1920",
"1200x628"
],
"num_images_per_size": 1,
"resolution": "1K",
"output_format": "png",
"safety_tolerance": 4
};
(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);
}
})();URL of the source image to recompose.
List of target dimensions as '<width>x<height>' (e.g. ['1024x1024','1920x1080']). 1-10 entries.
Optional extra instruction forwarded to the underlying recomposer (max 5000 chars).
Number of recomposition variants generated per target size (1-4).
min : 1,
max : 4
Target rendering resolution tier.
Allowed values:
Output image format.
Allowed values:
Safety tolerance level (1=strictest, 6=most permissive).
Allowed values:
Optional random seed for reproducibility.
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.
Smart Banner Resizer is a composition-aware image-to-image model on Segmind. Provide one source image and a list of target dimensions, and the model returns a recomposed output for every size — not a naive crop or pad. It is powered by Nano Banana Pro with vision-LLM-guided prompting, so it understands subjects, backgrounds, text zones, and visual hierarchy before laying out each variant. The result is one source asset turned into many platform-ready sizes without losing brand or layout integrity.
<width>x<height> strings.Defaults (1K, png, no prompt, safety_tolerance=4) produce strong results for most ad imagery — confirmed on a 16:9 product hero with splash and confetti elements recomposed cleanly into both 1:1 and 16:9 outputs. The optional prompt is a layout hint, not a generation instruction; use it for things like "leave headline space on the left" or "keep logo top-right". For final delivery, set resolution to 2K; reserve 4K for hero assets. Generation is recomposition-heavy (~60–120s for a multi-size batch) — use a fire-and-poll pattern.
Does it preserve text in my source image? Text is treated as a visual element. For text-heavy creatives, anchor it with an explicit prompt.
Can I get multiple options per size? Yes — set num_images_per_size to 2–4.
Which aspect ratios are supported? Any <width>x<height> pair you pass, including mixed ratios in a single call.
Is the output deterministic? Set seed to lock recomposition while iterating on prompt.
How many sizes can I request at once? Up to 10 per call.
What input formats work best? Clean hero shots in jpg, png, or webp recompose most reliably.