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


image_urlimage *

URL of the source image to recompose.


target_sizeslist * Affects Pricing

List of target dimensions as '<width>x<height>' (e.g. ['1024x1024','1920x1080']). 1-10 entries.


promptstr ( default: 1 )

Optional extra instruction forwarded to the underlying recomposer (max 5000 chars).


num_images_per_sizeint ( default: 1 ) Affects Pricing

Number of recomposition variants generated per target size (1-4).

min : 1,

max : 4


resolutionenum:str ( default: 1K ) Affects Pricing

Target rendering resolution tier.

Allowed values:


output_formatenum:str ( default: png )

Output image format.

Allowed values:


safety_toleranceenum:str ( default: 4 )

Safety tolerance level (1=strictest, 6=most permissive).

Allowed values:


seedint ( default: 1 )

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 — Composition-Aware Image Resize

What is Smart Banner Resizer?

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.

Key Features

  • Single source, many sizes: pass 1–10 target dimensions in one call as <width>x<height> strings.
  • Mixed aspect ratios in a single request: 1:1, 4:5, 9:16, 16:9, and arbitrary custom dimensions all work together.
  • Composition-aware recomposition: keeps the subject centered, preserves decorative and brand elements, avoids awkward cropping.
  • 1K, 2K, and 4K resolution tiers for drafts versus final hero assets.
  • Multiple variants per size (1–4) for A/B testing.
  • Output as png, jpeg, or webp.
  • Optional layout prompt and reproducible seed.

Best Use Cases

  • Performance marketing teams turning one product hero into Meta, Google, TikTok, and YouTube ad variants.
  • Agencies generating banner sets across IAB sizes from a single design.
  • E-commerce teams reformatting product photography for PDP, listings, and social.
  • Growth teams running A/B tests across creative variations and platforms.
  • Founders and content teams that need fast, on-brand resize without a designer in the loop.

Prompt Tips and Output Quality

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.

FAQs

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.