Z-Image Image Editing Workflow: Complete Guide to Inpainting + Outpainting + Uncrop
Published: 2026-06-10
Author: Z-Image Tech Blog
Reading time: ~12 minutes
Keywords: z-image inpainting, z-image outpainting, z-image uncrop, image editing workflow, z-image edit
Introduction
Image editing is one of the most practical applications in AI generation. The Z-Image model family demonstrates exceptional capabilities in Inpainting (localized regeneration), Outpainting (canvas expansion), and Uncrop (smart crop expansion), enabling professional-grade image editing when paired with ComfyUI workflows.
This article provides a comprehensive guide to Z-Image's three core image editing workflows, covering everything from basic operations to advanced techniques.
Overview of Z-Image's Three Editing Modes
| Mode | Purpose | Core Principle | Use Cases |
|---|---|---|---|
| Inpainting | Local modification/repair | Masked region regeneration + context blending | Object replacement, defect repair, text editing |
| Outpainting | Canvas expansion | Edge pixel guidance + content inference | Composition adjustment, scene extension, poster creation |
| Uncrop | Smart crop expansion | Adaptive resolution + semantic completion | Cross-platform adaptation, aspect ratio conversion |
Inpainting Workflow
What is Inpainting?
Inpainting is the technique of using AI to regenerate specified regions (marked by a Mask) within an existing image. Z-Image's inpainting capability is built on powerful contextual understanding — it not only generates new content within the masked region but also ensures natural blending with surrounding pixels.
Basic Inpainting Workflow (ComfyUI)
Node structure:
Load Image → Mask → VAEDecode + KSampler (inpaint) → Save Image
Key node configuration:
- LoadImage: Load the original image
- ImageToMask or MaskFromColor: Create the masked region
- VAEEncodeForInpaint: Encode the original image and mask into latent space
- KSampler (set
modelto inpainting model): Execute generation - VAEDecode: Decode the output
Z-Image Turbo Advantages for Inpainting
Z-Image Turbo leverages 8-step distilled inference for significant inpainting advantages:
- Speed: Single inpainting takes only 3-5 seconds (RTX 4090)
- Quality: High context fusion with natural edge transitions
- Consistency: Color tone and lighting match the original image
Practical Tips
Mask drawing techniques:
- Mask area should be slightly larger than the actual modification target
- Use feathering on mask edges to avoid hard boundaries
- For fine editing, use high-resolution masks matching the original image dimensions
Prompt strategy:
- Inpainting prompts only need to describe expected content within the masked region
- No need to re-describe the entire image
- Add negative prompts to exclude unwanted elements
Common application scenarios:
- Text modification: Cover existing text, input new text content
- Object replacement: Mask target object, replace with new object
- Face repair: Mask low-quality faces for regeneration
- Defect removal: Mask noise, watermarks, or unwanted elements
Outpainting Workflow
What is Outpainting?
Outpainting extends the image canvas outward, letting the AI infer and generate new edge regions based on existing content. This is a powerful tool for creative composition and poster design.
Outpainting Implementation
Core approach:
- Place the original image on a larger canvas
- Blank areas serve as the mask
- Use Inpainting mode to generate extended content
ComfyUI node structure:
Load Image → ImagePadForOutpaint (set expansion dimensions) → ImageToMask → VAEEncodeForInpaint → KSampler → VAEDecode → Save Image
Key Parameters
| Parameter | Recommended Value | Notes |
|---|---|---|
| Expansion ratio | 1.5x - 2x | Avoid excessive single-step expansion |
| Seed | Fixed | Maintain expansion consistency |
| CFG Scale | 5-7 | Recommended for Z-Image Turbo |
| Sampling steps | 8-12 | 8 steps sufficient for Turbo mode |
Multi-direction Expansion Strategy
Step-by-step expansion (recommended):
- Expand in one direction first (e.g., right)
- Use the result as the base for the next direction
- Keep each expansion ratio at 30%-50%
Four-direction simultaneous expansion:
- Expand up, down, left, and right at once
- Suitable for major expansion scenarios
- Note: Excessive expansion may reduce quality
Practical Tips
Maintaining style consistency:
- Use the same style descriptors as the original image
- Use ControlNet assistance (Canny/Depth) for composition constraints
- Iterate multiple times, fine-tuning each expansion area
Poster creation workflow:
- Use original product photo as the center
- Expand outward for background (natural scenery, city skyline)
- Add decorative elements in expanded areas
- Output final poster dimensions
Uncrop Workflow
What is Uncrop?
Uncrop is a specialized canvas expansion technique combining Outpainting and smart cropping. Unlike pure Outpainting, Uncrop can:
- Auto-adjust aspect ratio: Expand 1:1 images to 16:9, 9:16, etc.
- Intelligent expansion direction: Determine optimal expansion area based on content semantics
- Subject preservation: Ensure core content is not cropped out
Uncrop Workflow
ComfyUI implementation:
Load Image → Calculate Target Dimensions → ImagePadForOutpaint → Mask → KSampler (inpaint mode) → VAEDecode → Save Image
Key calculation logic:
# Calculate target dimensions
original_w, original_h = image.width, image.height
target_ratio = 16 / 9 # Target aspect ratio
current_ratio = original_w / original_h
if current_ratio < target_ratio:
# Need horizontal expansion
new_w = int(original_h * target_ratio)
pad_left = (new_w - original_w) // 2
pad_right = new_w - original_w - pad_left
else:
# Need vertical expansion
new_h = int(original_w / target_ratio)
pad_top = (new_h - original_h) // 2
pad_bottom = new_h - original_h - pad_top
Cross-platform Adaptation Scenarios
| Source Format | Target Platform | Target Aspect Ratio | Expansion Direction |
|---|---|---|---|
| 1:1 (Square) | YouTube Cover | 16:9 | Horizontal |
| 1:1 | Instagram Story | 9:16 | Vertical |
| 3:2 | WeChat Cover | 2.35:1 | Horizontal |
| 4:3 | Xiaohongshu | 3:4 | Vertical |
Advanced Tips
Subject protection:
- Exclude subject-containing areas from the mask
- Use semantic segmentation models (like SAM) for automatic subject detection
- Ensure the subject is reasonably positioned in the target canvas
Multi-resolution output:
- Generate multiple aspect ratio versions in one pass
- Use scripts for batch processing
- Ideal for cross-platform publishing scenarios
Combined Workflow: Inpainting + Outpainting
Combination Scenarios
In real-world creation, multiple editing modes are often combined:
Scenario 1: Product Photo Retouching
- Inpainting: Remove defects and unwanted elements from the original
- Outpainting: Expand canvas for advertising background
- Uncrop: Adjust final aspect ratio for the publishing platform
Scenario 2: Artistic Creation Expansion
- Outpainting: Expand small artwork to large dimensions
- Inpainting: Add details and decorations in expanded areas
- Uncrop: Generate multiple aspect ratio versions
Combined Workflow Example
Original Image
↓ [Inpainting]
Retouched Image (defects removed, elements modified)
↓ [Outpainting]
Expanded Image (larger canvas, background added)
↓ [Uncrop]
Multi-version Output (1:1, 16:9, 9:16, 3:4)
Common Issues and Solutions
Q1: Expanded area doesn't match original style
Cause: Prompt description is insufficient or expansion ratio is too large.
Solution:
- Add more detailed style descriptors (color, lighting, texture)
- Reduce single-step expansion ratio, expand in multiple passes
- Use ControlNet assistance for constraints
Q2: Inpainting edges show hard boundaries or unnatural transitions
Cause: Insufficient mask feathering or limited model blending capability.
Solution:
- Increase mask feather radius (10-20 pixels)
- Slightly expand the mask area
- Use Z-Image base model instead of Turbo for fine editing
Q3: Outpainting generates repetitive or patterned content
Cause: AI tends to repeat existing patterns without clear guidance.
Solution:
- Provide specific descriptions for expanded areas
- Use different random seeds for multiple attempts
- Combine ControlNet Depth/Normal mode for structural constraints
Q4: Subject position is suboptimal after Uncrop
Cause: Automatic expansion direction calculation didn't account for subject position.
Solution:
- Manually specify expansion direction
- Use semantic segmentation to pre-identify subject position
- Fine-tune final composition with cropping tools after expansion
Performance Optimization Tips
Hardware Recommendations
| Configuration | Suitable For | Processing Speed |
|---|---|---|
| RTX 3060 (12GB) | Entry-level Inpainting | ~8s per operation |
| RTX 4090 (24GB) | Professional full workflow | ~3s per operation |
| Mac M4 Max (128GB) | Cross-platform workflow | ~10s per operation |
Batch Processing Tips
- Use ComfyUI batch processing nodes for simultaneous multi-image processing
- For batch editing with consistent style, use fixed Prompt templates
- Pre-calculate masks and parameters to reduce repetitive operations
Summary
Z-Image's image editing capabilities — Inpainting, Outpainting, and Uncrop — form a powerful creative toolkit. Mastering these three core workflows and their combinations enables you to:
- Precise editing: Pixel-level image modification via Inpainting
- Creative expansion: Break through original composition limits via Outpainting
- Cross-platform adaptation: One-click multi-platform version generation via Uncrop
Combined with Z-Image Turbo's 8-step fast inference, these workflows see significant efficiency gains, making them ideal choices for both professional creators and everyday users.
This article is part of the Z-Image Tech Blog Season 11 series. Stay tuned for more in-depth technical content.