GPT Image 2 - Image Mask Editor
Edit and transform specific areas of images using mask-based selection with OpenAI's GPT Image 2 model. This premium inpainting solution delivers the highest creative fidelity with fully custom output dimensions. Precisely define areas to edit with a mask, then describe your desired changes using natural language for intelligent content generation.
Endpoint
Request Headers
| Field | Value |
|---|---|
| API-KEY | <api-key> |
| Content-Type | application/json |
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Feature type identifier. Must be IMAGE_INPAINTER |
model | string | Yes | AI model identifier. Must be gpt-image-2 |
promptObject | object | Yes | Configuration object containing all image editing parameters |
Prompt Object Parameters
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
imageUrl | string | Yes | Path to the source image to be edited | - |
maskUrl | string | Yes | Path to the mask image (white=edit, black=preserve) | - |
prompt | string | Yes | Description of content to generate in masked areas (max 4000 characters) | - |
size | string | Yes | Output image dimensions in WxH format (e.g. 1024x1024) | - |
quality | string | Yes | Quality level of the generated content | - |
n | number | No | Number of images to generate (1-10) | 1 |
background | string | No | Background transparency mode | auto |
output_format | string | No | Output format for the processed image | - |
Size Constraints
GPT Image 2 accepts any custom dimension in WxH format (e.g. 1024x1024, 1280x720) subject to the following rules:
| Constraint | Rule | Example |
|---|---|---|
| Block size | Width and height must both be divisible by 16 | 1024x1024 ✓, 1000x1000 ✗ |
| Minimum pixels | Width × Height ≥ 655,360 | 1024×640 = 655,360 ✓ |
| Maximum pixels | Width × Height ≤ 8,294,400 | 2880×2880 = 8,294,400 ✓ |
| Maximum edge | Max(width, height) ≤ 3,840 px | 3840×864 ✓, 4096×1024 ✗ |
| Aspect ratio | Max edge / Min edge ≤ 3:1 | 3072×1024 ✓, 3840×512 ✗ |
Quality Options
| Quality | Description | Use Case |
|---|---|---|
low | Faster processing, good detail | Quick iterations, concept testing |
medium | Balanced quality and speed | Standard workflows, most projects |
high | Maximum detail and blending | Professional work, critical edits, final outputs |
Background Options
| Background | Description | Use Case |
|---|---|---|
auto | Model selects the best background mode | General purpose, recommended default |
opaque | Solid background | Standard images, no transparency needed |
Output Format Options
| Format | Description | Best For |
|---|---|---|
png | Lossless format with transparency support | Professional use, detailed editing, archival quality |
jpeg | Compressed format suitable for photographs | Web optimization, social media |
webp | Modern format with superior compression | Web applications, modern browsers |
Mask Image Requirements
| Requirement | Description |
|---|---|
| Format | PNG, JPEG, or WebP formats supported |
| Dimensions | Must match source image dimensions exactly |
| Color Scheme | White (#FFFFFF) = edit areas, Black (#000000) = preserve areas |
| Grayscale Support | Gray values for partial blending and soft transitions |
| Edge Quality | Clean, well-defined boundaries for best results |
Code Examples
- cURL
- JavaScript
- Python
curl -X POST "https://api.1min.ai/api/features" \
-H "API-KEY: <api-key>" \
-H "Content-Type: application/json" \
-d '{
"type": "IMAGE_INPAINTER",
"model": "gpt-image-2",
"promptObject": {
"imageUrl": "development/images/2025_12_04_18_10_29_882_cat.png",
"maskUrl": "development/images/2025_12_04_18_11_04_824_mask.png",
"prompt": "A cozy fireplace with warm flickering flames and rustic brick surround",
"size": "1024x1024",
"quality": "high",
"n": 1,
"background": "auto",
"output_format": "png"
}
}'
fetch('https://api.1min.ai/api/features', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'API-KEY': 'YOUR_API_KEY'
},
body: JSON.stringify({
type: 'IMAGE_INPAINTER',
model: 'gpt-image-2',
promptObject: {
imageUrl: 'development/images/2025_12_04_18_10_29_882_cat.png',
maskUrl: 'development/images/2025_12_04_18_11_04_824_mask.png',
prompt: 'A cozy fireplace with warm flickering flames and rustic brick surround',
size: '1024x1024',
quality: 'high',
n: 1,
background: 'auto',
output_format: 'png'
}
})
})
.then(response => response.json())
.then(data => console.log(data));
import requests
url = "https://api.1min.ai/api/features"
headers = {
"Content-Type": "application/json",
"API-KEY": "YOUR_API_KEY"
}
data = {
"type": "IMAGE_INPAINTER",
"model": "gpt-image-2",
"promptObject": {
"imageUrl": "development/images/2025_12_04_18_10_29_882_cat.png",
"maskUrl": "development/images/2025_12_04_18_11_04_824_mask.png",
"prompt": "A cozy fireplace with warm flickering flames and rustic brick surround",
"size": "1024x1024",
"quality": "high",
"n": 1,
"background": "auto",
"output_format": "png"
}
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
Interactive Playground
API Playground
https://api.1min.ai/api/featuresPath to the source image to be edited
Path to the mask image (white = edit area, black = preserve area)
Describe the content to generate in masked areas (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
Number of variations to generate (1-10)
Background transparency mode
Format of the output image
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": "IMAGE_INPAINTER",
"model": "gpt-image-2",
"promptObject": {
"imageUrl": "development/images/2025_12_04_18_10_29_882_cat.png",
"maskUrl": "development/images/2025_12_04_18_11_04_824_mask.png",
"prompt": "A cozy fireplace with warm flickering flames and rustic brick surround",
"size": "1024x1024",
"quality": "medium",
"n": 1,
"background": "auto",
"output_format": "png"
}
}'
Response Format
{
"aiRecord": {
"uuid": "d1e2f3g4-h5i6-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": 320000,
"createdAt": "2025-01-01T00:00:00.000Z",
"createdBy": "SYSTEM",
"updatedAt": "2025-01-15T12:00:00.000Z",
"updatedBy": "SYSTEM"
},
"model": "gpt-image-2",
"type": "IMAGE_INPAINTER",
"metadata": null,
"rating": null,
"feedback": null,
"conversationId": null,
"status": "SUCCESS",
"createdAt": "2025-01-15T12:00:00.000Z",
"aiRecordDetail": {
"promptObject": {
"imageUrl": "development/images/2025_12_04_18_10_29_882_cat.png",
"maskUrl": "development/images/2025_12_04_18_11_04_824_mask.png",
"prompt": "A cozy fireplace with warm flickering flames and rustic brick surround",
"size": "1024x1024",
"quality": "high",
"n": 1,
"background": "auto",
"output_format": "png"
},
"resultObject": [
"development/images/2025_01_15_12_00_30_001_inpainted.png"
],
"responseObject": {}
},
"additionalData": null,
"temporaryUrl": "https://s3.us-east-1.amazonaws.com/asset.1min.ai/development/images/2025_01_15_12_00_30_001_inpainted.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=EXAMPLE_CREDENTIAL&X-Amz-Date=20250115T120000Z&X-Amz-Expires=604800&X-Amz-Signature=example_signature&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject"
}
}
Use Cases
Precision Photo Editing
- Object Replacement: Replace specific objects with entirely new content
- Background Filling: Fill removed areas with contextually appropriate content
- Defect Removal: Remove blemishes, objects, or unwanted elements seamlessly
- Content Addition: Add new elements to specific areas of existing images
Creative & Artistic Projects
- Composite Artwork: Seamlessly blend generated content into existing images
- Scene Extension: Expand or modify specific parts of creative works
- Character Modification: Update clothing, expressions, or accessories
- Concept Visualization: Iterate on specific design elements within larger compositions
Product & Commercial Photography
- Product Enhancement: Update product details, colors, or features in existing shots
- Label Modification: Update product packaging or branding in existing images
- Environment Adaptation: Modify backgrounds or settings for different markets
- Damage Restoration: Restore damaged or incomplete product imagery
Real Estate & Architecture
- Virtual Renovation: Preview renovation outcomes by modifying specific areas
- Furniture Placement: Test different furniture or decor in specific areas of rooms
- Exterior Updates: Modify facades, landscaping, or outdoor elements
- Interior Design: Swap out specific design elements like flooring, walls, or fixtures