Skip to main content

GPT Image 2 - Background Replacer

Replace and transform image backgrounds using natural language descriptions with OpenAI's GPT Image 2 model. This premium background replacement solution delivers the highest creative fidelity with fully custom output dimensions, allowing you to specify any resolution that meets the model's size constraints.

Endpoint

Request Headers

FieldValue
API-KEY<api-key>
Content-Typeapplication/json

Parameters

ParameterTypeRequiredDescription
typestringYesFeature type identifier. Must be BACKGROUND_REPLACER
modelstringYesAI model identifier. Must be gpt-image-2
promptObjectobjectYesConfiguration object containing background replacement parameters

Prompt Object Parameters

ParameterTypeRequiredDescriptionDefault
imageUrlstringYesPath to the source image for background replacement-
promptstringYesDescription of desired background scene (max 4000 characters)-
sizestringYesOutput image dimensions in WxH format (e.g. 1024x1024)-
qualitystringYesQuality level of the generated background-
backgroundstringNoBackground transparency modeauto

Size Constraints

GPT Image 2 accepts any custom dimension in WxH format (e.g. 1024x1024, 1280x720) subject to the following rules:

ConstraintRuleExample
Block sizeWidth and height must both be divisible by 161024x1024 ✓, 1000x1000
Minimum pixelsWidth × Height ≥ 655,3601024×640 = 655,360 ✓
Maximum pixelsWidth × Height ≤ 8,294,4002880×2880 = 8,294,400 ✓
Maximum edgeMax(width, height) ≤ 3,840 px3840×864 ✓, 4096×1024 ✗
Aspect ratioMax edge / Min edge ≤ 3:13072×1024 ✓, 3840×512 ✗

Quality Options

QualityDescriptionUse Case
lowFaster processing, good qualityQuick previews, iterations
mediumBalanced quality and speedStandard workflows, most projects
highMaximum detail and realismProfessional work, final outputs

Background Options

BackgroundDescriptionUse Case
autoModel selects the best background modeGeneral purpose, recommended default
opaqueSolid backgroundStandard images, no transparency needed

Code Examples

curl -X POST "https://api.1min.ai/api/features" \
-H "API-KEY: <api-key>" \
-H "Content-Type: application/json" \
-d '{
"type": "BACKGROUND_REPLACER",
"model": "gpt-image-2",
"promptObject": {
"imageUrl": "development/images/2025_12_04_18_03_51_184_cat.png",
"prompt": "professional studio background with soft gray gradient, subtle lighting from top-left, minimalist and clean aesthetic",
"size": "1024x1024",
"quality": "high",
"background": "auto"
}
}'

Interactive Playground

API Playground

https://api.1min.ai/api/features
Path to the source image for background replacement
Describe the new background you want (max 4000 characters)
Custom dimensions in WxH format. Both values must be divisible by 16. E.g. 1024x1024, 1536x1024, 1024x1536
Quality level affects detail and credit cost
Background transparency mode

Generated cURL Command:

curl -X POST "https://api.1min.ai/api/features" \
-H "API-KEY: <your-api-key>" \
-H "Content-Type: application/json" \
-d '{
"type": "BACKGROUND_REPLACER",
"model": "gpt-image-2",
"promptObject": {
"imageUrl": "development/images/2025_12_04_18_03_51_184_cat.png",
"prompt": "professional studio background with soft gray gradient, subtle lighting from top-left, minimalist and clean aesthetic",
"size": "1024x1024",
"quality": "high",
"background": "auto"
}
}'

Response Format

{
"aiRecord": {
"uuid": "b1g2r3m4-v5e6-7890-abcd-ef1234567890",
"userId": "user-12345",
"teamId": "team-67890",
"teamUser": {
"teamId": "team-67890",
"userId": "user-12345",
"userName": "Jane Designer",
"userAvatar": "https://example.com/avatar.jpg",
"status": "ACTIVE",
"role": "ADMIN",
"creditLimit": 100000000,
"usedCredit": 250000,
"createdAt": "2025-01-01T00:00:00.000Z",
"createdBy": "SYSTEM",
"updatedAt": "2025-01-15T14:00:00.000Z",
"updatedBy": "SYSTEM"
},
"model": "gpt-image-2",
"type": "BACKGROUND_REPLACER",
"metadata": null,
"rating": null,
"feedback": null,
"conversationId": null,
"status": "SUCCESS",
"createdAt": "2025-01-15T14:00:00.000Z",
"aiRecordDetail": {
"promptObject": {
"imageUrl": "development/images/2025_12_04_18_03_51_184_cat.png",
"prompt": "professional studio background with soft gray gradient, subtle lighting from top-left, minimalist and clean aesthetic",
"size": "1024x1024",
"quality": "high",
"background": "auto"
},
"resultObject": [
"development/images/2025_01_15_14_00_30_001_background_replaced.png"
],
"responseObject": {}
},
"additionalData": null,
"temporaryUrl": "https://s3.us-east-1.amazonaws.com/asset.1min.ai/development/images/2025_01_15_14_00_30_001_background_replaced.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=EXAMPLE_CREDENTIAL&X-Amz-Date=20250115T140000Z&X-Amz-Expires=604800&X-Amz-Signature=example_signature&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject"
}
}

Use Cases

Professional Photography & Portraits

  • Studio Backgrounds: Create professional studio settings with gradient or solid color backgrounds
  • Environmental Portraits: Place subjects in specific locations or environments
  • Headshot Enhancement: Transform casual photos into professional headshots
  • Virtual Backgrounds: Create custom backgrounds for video conferencing assets

E-commerce & Product Photography

  • Product Isolation: Replace cluttered backgrounds with clean, professional settings
  • Lifestyle Contexts: Place products in realistic usage environments
  • Brand Consistency: Apply branded backgrounds across product catalogs
  • Seasonal Themes: Update product photos with seasonal or holiday backgrounds

Marketing & Advertising

  • Campaign Customization: Adapt imagery for different markets with location-appropriate backgrounds
  • Brand Integration: Replace backgrounds with branded environments
  • Mood Creation: Set specific atmospheres that align with campaign messaging
  • Social Media: Create platform-optimized backgrounds for different channels

Creative & Artistic Projects

  • Fantasy Scenes: Place subjects in imaginative or impossible environments
  • Artistic Styles: Generate artistic or stylized backgrounds
  • Conceptual Photography: Create conceptual images with specific thematic backgrounds
  • Story Telling: Create narrative contexts through background replacement