Image Remix

Mask-based image editing

Edit existing images with DALL-E 2 by describing what you want to change.
Precise mask-based editing for specific areas and seamless modifications.

← Back to Home
📸 Original Image
Original winter ski scene

Beautiful winter cross-country ski scene

🎭 Edit Area
Mask showing editable area

The white area in the sky shows where your prompt will be applied

🎨 Edit Parameters
Be specific about what you want to see in the white masked area
Larger sizes may take longer
📝 Model: DALL-E 2 (specialized for image editing)
Starting image editing...
🎨 Ready to Edit

Fill out the form and click "Edit Image" to see AI magic happen! The white area in the sky will be replaced with your prompt.

💡 Example Prompts:
  • • "A hot air balloon floating in the sky"
  • • "A flock of birds flying south for winter"
  • • "A ski jumper soaring through the air"
  • • "A small airplane with winter landing skis"
  • • "Northern lights dancing across the sky"
  • • "A paraglider with bright colorful wings"
✏️ About AI Image Editing
🎨 Image Editing

DALL-E 2 can seamlessly edit images by replacing masked areas with AI-generated content based on your prompt.

💡 Use Cases

Background replacement, object insertion, artistic enhancement, style modification, and creative transformations.

🤖 Model

DALL-E 2: Currently the only OpenAI model that supports image editing with masks

⚙️ Requirements

Original Image: PNG format, square aspect ratio
Mask: White areas indicate where to edit, black areas remain unchanged
Prompt: Clear description of what to add/replace


💻 Essential Code

Key Kotlin code for AI image editing using OpenAI's DALL-E 2 API:

// Edit image with DALL-E 2
suspend fun editImage(
    prompt: String,
    imageFile: ByteArray,
    maskFile: ByteArray,
    model: String = "dall-e-2",
    size: String = "1024x1024"
): ImageEditResponse {
    val response = client.submitFormWithBinaryData(
        url = "https://api.openai.com/v1/images/edits",
        formData = formData {
            append("prompt", prompt)
            append("model", model)
            append("size", size)
            append("response_format", "url")
            append("image", imageFile, Headers.build {
                append(HttpHeaders.ContentType, "image/png")
                append(HttpHeaders.ContentDisposition, "filename=\"image.png\"")
            })
            append("mask", maskFile, Headers.build {
                append(HttpHeaders.ContentType, "image/png")
                append(HttpHeaders.ContentDisposition, "filename=\"mask.png\"")
            })
        }
    ) {
        headers { append("Authorization", "Bearer $openaiApiKey") }
        timeout { requestTimeoutMillis = 300000 }
    }
    
    return json.decodeFromString<ImageEditResponse>(response.bodyAsText())
}

// Usage in controller
val editResponse = openAI.editImage(
    prompt = "A hot air balloon floating in the sky",
    imageFile = originalImageBytes,
    maskFile = maskImageBytes,
    model = Models.ImageGeneration.DALL_E_2,
    size = "1024x1024"
)
val editedImageUrl = editResponse.data.firstOrNull()?.url