Flux Pro integration
Powered by Flux Pro, this API expands images beyond their original boundaries using AI-generated content that seamlessly blends with the original.
Key capabilities
- Directional expansion: Independently control expansion on each edge (left, right, top, bottom) from 0 to 2048 pixels
- Prompt-guided generation: Optional text descriptions to guide what appears in expanded areas
- Seamless blending: AI-generated content matches the style, lighting, and composition of the original image
- Flexible input: Accept base64-encoded images for easy integration
- Predictable output size: Every result is normalized to roughly 1.6 megapixels, whatever the input was
- Async processing: Webhook notifications or polling for task completion
Use cases
- Social media adaptation: Convert landscape images to portrait format (or vice versa) for different platforms
- Print production: Add bleed area or extend backgrounds for large-format printing
- Design workflows: Create additional canvas space for text overlays, logos, or design elements
- Photography enhancement: Extend cropped photos to recover lost composition
- E-commerce: Expand product images to fit standardized dimensions
- Marketing materials: Adapt hero images to various banner sizes and aspect ratios
Expand images with Flux Pro
Submit an image with expansion parameters to extend it in any direction. The service returns a task ID for async polling or webhook notification.POST /v1/ai/image-expand/flux-pro
Create a new image expansion task
GET /v1/ai/image-expand/flux-pro
List all image expansion tasks
GET /v1/ai/image-expand/flux-pro/{task-id}
Get task status and results by ID
Parameters
Input requirements
The image you submit must be:- At least 256 pixels on each side. A 255x70500 image is refused even though it is only 18 megapixels, because one of its sides is too short.
- At most 20 megapixels (
width x heightup to 20,000,000). Neither side is capped on its own and there is no aspect ratio restriction, so a 30000x600 image is fine.
Sending a larger image does not produce a larger or sharper result. Every expansion is normalized to roughly 1.6 megapixels, so a 20 megapixel input and a 2 megapixel input come back at the same size. Resize before uploading.
Frequently Asked Questions
What is Flux Pro Image Expand and how does it work?
What is Flux Pro Image Expand and how does it work?
Flux Pro Image Expand is an AI-powered outpainting API that extends images beyond their original boundaries. You submit a base64-encoded image with expansion values for each edge (left, right, top, bottom), receive a task ID immediately, then poll for results or receive a webhook notification. The API generates new content that seamlessly blends with the original image.
How much can I expand an image?
How much can I expand an image?
You can expand up to 2048 pixels on each edge (left, right, top, bottom) independently. Set any edge to 0 if you do not want to expand in that direction. For example, to only extend the width, set
left and right values while keeping top and bottom at 0.Is there a size limit on the image I send?
Is there a size limit on the image I send?
Yes. Each side must be at least 256 pixels, and the image must not exceed 20 megapixels in total (
width x height up to 20,000,000). The limit is on pixels, not on file size, so compressing a 60 megapixel photo does not help. Note that the two rules are independent: a very long, very thin image can be under 20 megapixels and still be refused because one of its sides is below 256 pixels.Sending a bigger image gains you nothing either way, since the result is normalized to roughly 1.6 megapixels regardless of the input.What image formats are supported?
What image formats are supported?
The API accepts base64-encoded images. Common formats like JPEG, PNG, and WebP can be encoded and submitted. The output is returned as a downloadable image URL.
How does the prompt parameter work?
How does the prompt parameter work?
The optional
prompt parameter guides what the AI generates in the expanded areas. For example, “blue sky with clouds” will generate sky content, while “brick wall” will generate a wall background. If omitted, the AI infers appropriate content from the existing image context.Will the expanded areas match my original image?
Will the expanded areas match my original image?
Yes, Flux Pro analyzes your image’s style, lighting, color palette, and composition to generate expansions that blend seamlessly. The AI maintains visual consistency so the final image appears natural and cohesive.
What are the rate limits for Image Expand?
What are the rate limits for Image Expand?
Rate limits vary by subscription tier. See Rate Limits for current limits.
How much does Image Expand cost?
How much does Image Expand cost?
See the Pricing page for current rates and subscription options.
Best practices
- Balanced expansion: For best results, avoid extreme asymmetric expansions; gradual extensions maintain better visual coherence
- Prompt specificity: Use descriptive prompts when you need specific content in expanded areas (e.g., “ocean waves” instead of just “water”)
- Input size: Keep the input between 256 pixels per side and 20 megapixels. Beyond that the request is refused, and below it extra resolution is wasted anyway: the result is normalized to roughly 1.6 megapixels
- Edge content: Ensure the edges of your original image have enough context for the AI to continue naturally
- Production integration: Use webhooks instead of polling for scalable applications
- Error handling: Implement retry logic with exponential backoff for 503 errors
Related APIs
- Flux 2 Pro: Generate images from text descriptions
- Flux Kontext Pro: Text-to-image with context understanding and image guidance
- Image Upscaler: Enhance image resolution and quality
- Remove Background: Remove image backgrounds for compositing