Smart Banner Resizer Serverless API
Recompose one image into multiple ad and banner sizes.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/smart-banner-resizer"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "image_url": "https://segmind-resources.s3.amazonaws.com/input/smart-banner-resizer-input.png",
12 "target_sizes": [
13 "1080x1080",
14 "1080x1920",
15 "1200x628"
16 ],
17 "num_images_per_size": 1,
18 "resolution": "1K",
19 "output_format": "png",
20 "safety_tolerance": "4"
21}
22
23response = requests.post(url, headers=headers, json=data)
24
25if response.status_code == 200:
26 result = response.json()
27 print(json.dumps(result, indent=2))
28else:
29 print(f"Error: {response.status_code}")
30 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/smart-banner-resizer"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "image_url": "https://segmind-resources.s3.amazonaws.com/input/smart-banner-resizer-input.png",
12 "target_sizes": [
13 "1080x1080",
14 "1080x1920",
15 "1200x628"
16 ],
17 "num_images_per_size": 1,
18 "resolution": "1K",
19 "output_format": "png",
20 "safety_tolerance": "4"
21}
22
23response = requests.post(url, headers=headers, json=data)
24
25if response.status_code == 200:
26 result = response.json()
27 print(json.dumps(result, indent=2))
28else:
29 print(f"Error: {response.status_code}")
30 print(response.text)API Endpoint
https://api.segmind.com/v1/smart-banner-resizerParameters
image_urlrequiredstring (uri)URL of the source image to recompose.
"https://segmind-resources.s3.amazonaws.com/input/smart-banner-resizer-input.png"target_sizesrequiredstring[]List of target dimensions as '<width>x<height>' (e.g. ['1024x1024','1920x1080']). 1-10 entries.
num_images_per_sizeoptionalintegerNumber of recomposition variants generated per target size (1-4).
1Range: 1 - 4output_formatoptionalstringOutput image format.
"png""png""jpeg""webp"promptoptionalstringOptional extra instruction forwarded to the underlying recomposer (max 5000 chars).
""resolutionoptionalstringTarget rendering resolution tier.
"1K""1K""2K""4K"safety_toleranceoptionalintegerSafety tolerance level (1=strictest, 6=most permissive).
4123456seedoptionalintegerOptional random seed for reproducibility.
nullResponse Type
Returns: Image
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out