AI Ad Banner Resizer

Easily convert ad creatives and banners to any desired size or aspect ratio using our intelligent AI-based resizing workflow. Designed for performance marketers, designers, and digital advertisers, this tool automates the process of adapting ad images across multiple platforms and formats—without losing visual quality or layout consistency. With just two simple inputs—the original banner image and the target aspect ratio—our workflow generates a high-quality, size-adapted version that’s optimized for your specific needs. Whether you’re resizing square Instagram ads to widescreen YouTube thumbnails, converting vertical stories into horizontal display ads, or generating landscape web banners from portrait creatives, our system intelligently repositions, scales, and preserves key elements in the design. Use any of the following values for aspect ratio - [ "match_input_image", "1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "4:5", "5:4", "21:9", "9:21", "2:1", "1:2"].

~35.88s
~$0.1074
 1import requests
 2import time
 3import json
 4
 5api_key = "YOUR_API_KEY"
 6url = "https://api.segmind.com/workflows/6863c56b4727e611dfa21ad5-v2"
 7
 8data = {
 9    "image": "https://segmind-inference-inputs.s3.amazonaws.com/3106c138-16f2-4372-b694-baa5e2e58bef-5e10ede4-9090-4c0e-9610-b37f3e2a24cf.png",
10    "aspect_ratio": "16:9"
11}
12
13def poll_for_result(poll_url):
14    """Poll the API until the generation is complete"""
15    while True:
16        response = requests.get(
17            poll_url,
18            headers={'Authorization': f'Bearer {api_key}'}
19        )
20        result = response.json()
21
22        if result['status'] == 'COMPLETED':
23            # Parse the output (it's a JSON string)
24            outputs = json.loads(result['output'])
25            return outputs
26        elif result['status'] == 'FAILED':
27            raise Exception(result.get('error', 'Generation failed'))
28
29        # Wait 7 seconds before polling again
30        time.sleep(7)
31
32# Make the initial request
33response = requests.post(
34    url,
35    json=data,
36    headers={
37        'Authorization': f'Bearer {api_key}',
38        'Content-Type': 'application/json'
39    }
40)
41
42if response.status_code == 200:
43    result = response.json()
44    print('Request queued:', result)
45
46    # Start polling for results
47    outputs = poll_for_result(result['poll_url'])
48    print('Generation complete:', outputs)
49else:
50    print(f"Error: {response.status_code}")
51    print(response.text)

API Endpoint

POSThttps://api.segmind.com/workflows/6863c56b4727e611dfa21ad5-v2

Parameters

imageoptional
string (uri)

Image

Default: "https://segmind-inference-inputs.s3.amazonaws.com/3106c138-16f2-4372-b694-baa5e2e58bef-5e10ede4-9090-4c0e-9610-b37f3e2a24cf.png"
aspect_ratiooptional
string

Aspect Ratio

Default: "16:9"

Response Format

Returns: Polling-based asynchronous response

Initial request returns a poll_url. Poll every 7 seconds until status is COMPLETED.

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Workflow not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out