Home API AI Expand API

AI Expander API

Outpaint images beyond their borders with LightX AI Expander API. You can generate new content around your image while matching the existing content. The tool extends images naturally and ensures consistent and visually balanced outputs.

AI Expander API enlarges a model in a flowy dress in multiple directions and sizes

Explore Creative Ways to Use the AI Image Expander API

Use this API to extend landscapes into panoramic photos.

Easy Integration with Popular Frameworks
Easily integrate our API with CSS, React, Tailwind, JS, and Python for versatile and powerful applications.
import requests

url = 'https://api.lightxeditor.com/external/api/v1/expand-photo'
headers = {
'Content-Type': 'application/json',
'x-api-key': '<Insert your API Key>'  # Replace with your actual API key
}

data = {
"imageUrl": "https://example.com/your-image.jpg",  # Replace with the URL of your input image
"leftPadding": 0,  # Replace left padding
"rightPadding": 0,  # Replace right padding
"topPadding": 0,  # Replace top padding
"bottomPadding": 0  # Replace bottom padding
}

response = requests.post(url, headers=headers, json=data)

# Check if the request was successful
if response.status_code == 200:
print("Request was successful!")
print(response.json())
else:
print(f"Request failed with status code: {response.status_code}")
print(response.text)
const fetch = require('node-fetch');  // Only needed if you are using Node.js

const url = 'https://api.lightxeditor.com/external/api/v1/expand-photo';
const apiKey = '<Insert your API Key>';  // Replace with your actual API key

const data = {
"imageUrl": "https://example.com/your-image.jpg",  // Replace with the URL of your input image
"leftPadding": 0,  // Replace with the desired left padding
"rightPadding": 0,  // Replace with the desired right padding
"topPadding": 0,  // Replace with the desired top padding
"bottomPadding": 0  // Replace with the desired bottom padding
};

const options = {
method: 'POST',
headers: {
    'Content-Type': 'application/json',
    'x-api-key': apiKey
},
body: JSON.stringify(data)
};

fetch(url, options)
.then(response => {
    if (!response.ok) {
        throw new Error(`Request failed with status code ${response.status}`);
    }
    return response.json();
})
.then(data => {
    console.log('Request was successful!');
    console.log(data);
})
.catch(error => {
    console.error('Error:', error);
});

}
import Foundation

// Define the URL and API key
let url = URL(string: "https://api.lightxeditor.com/external/api/v1/expand-photo")!
let apiKey = "<Insert your API Key>"  // Replace with your actual API key

// Define the request body
let requestBody: [String: Any] = [
"imageUrl": "https://example.com/your-image.jpg",  // Replace with the URL of your input image
"leftPadding": 0, // Replace left padding
"rightPadding": 0, // Replace right padding
"topPadding": 0, // Replace top padding
"bottomPadding": 0 // Replace bottom padding
]

// Convert request body to JSON data
let jsonData = try! JSONSerialization.data(withJSONObject: requestBody, options: [])

// Create the URLRequest object
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue(apiKey, forHTTPHeaderField: "x-api-key")
request.httpBody = jsonData

// Create the URLSession data task
let task = URLSession.shared.dataTask(with: request) { data, response, error in
// Handle the response
if let error = error {
    print("Error: \(error)")
    return
}

guard let httpResponse = response as? HTTPURLResponse, (200...299).contains(httpResponse.statusCode) else {
    print("Unexpected response")
    return
}

if let data = data {
    do {
        // Parse and print the JSON response
        let jsonResponse = try JSONSerialization.jsonObject(with: data, options: [])
        print("Response: \(jsonResponse)")
    } catch {
        print("Error parsing JSON: \(error)")
    }
}
}

// Start the task
task.resume()
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.Response
import org.json.JSONObject

fun main() {
// Define the URL and API key
val url = "https://api.lightxeditor.com/external/api/v1/expand-photo"
val apiKey = "<Insert your API Key>"  // Replace with your actual API key

// Define the request body
val requestBody = JSONObject().apply {
    put("imageUrl", "https://example.com/your-image.jpg")  // Replace with the URL of your input image
    put("leftPadding", 0)  // Replace with the left padding value
    put("rightPadding", 0) // Replace with the right padding value
    put("topPadding", 0)   // Replace with the top padding value
    put("bottomPadding", 0) // Replace with the bottom padding value
}.toString()

// Create OkHttpClient
val client = OkHttpClient()

// Create the request
val request = Request.Builder()
    .url(url)
    .post(requestBody.toRequestBody("application/json; charset=utf-8".toMediaType()))
    .addHeader("x-api-key", apiKey)
    .build()

// Make the request
client.newCall(request).execute().use { response ->
    if (!response.isSuccessful) {
        throw IOException("Unexpected code $response")
    }

    // Print the response
    val responseData = response.body?.string()
    println("Response: $responseData")
}
}
Method- Post
curl --location 'https://api.lightxeditor.com/external/api/v1/expand-photo' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <Insert your API Key>' \
--data '{
"imageUrl": "https://example.com/your-image.jpg",  // Replace with the URL of your input image
"leftPadding": 0, // Replace left Padding
"rightPadding": 0, // Replace right Padding
"topPadding": 0, // Replace top Padding
"bottomPadding": 0 // Replace bottom Padding
}'

Choose Your Plan

Explore a variety of pricing plans designed to meet your unique requirements. Find the perfect fit and start today.

Seamless Image Edge Extension API

The AI expands your image by generating new content that naturally merges with the original. It keeps the same style, colors, and details as the original, ensuring that the transition is smooth and natural. With precise edge continuity, the finished image will appear complete without any jarring transitions or mismatches.

Mountain resort photo expanded with AI extender API for a panoramic view

Un-crop Images In Any Direction With Selective Area Expansion

The tool comes with an aspect ratio adjuster that restores cropped images to any size. The AI skillfully increases the image width or length, making cut-off objects look whole again. However, please be aware that it cannot recreate real people who were originally part of the image.

Beach photo expanded horizontally using AI image extension API

Get High Resolution Outputs In Less Processing Time

The LightX AI Expander API provides high-resolution image expansions while maintaining fast processing times, even for larger images. We’ve optimized it to ensure that you receive detailed, top-quality results in significantly less time than you'd expect.

Image of a girl standing by a car extended with uncrop API for a wider view

Start with Free Credits

Get started with LightX APIs today! Receive 25 free credits instantly on API signup – no credit card required

Frequently Asked Questions

Yes! The text prompts option is provided. You get full control to guide the AI on what to add in the extended area. You can add specific features, objects, or elements to the expanded areas of the image.

Still Unsure? Allow Us To Assist You!

Write to us and we'd love to understand your requirements

Drop an image anywhere to upload
Upload one image at a time