TiledImageGenerationTask
Recursively generates and upscales images for ultra-high resolution. Uses a multi-level tiling strategy to refine specific regions with generative AI.
Category: Writing
Resource Intensive
Recursive Upscaling
⚙️ TiledImageGenerationConfig.json
{
"output_file": "posters/cyberpunk_city.png",
"prompts": [
"A sprawling cyberpunk city at night",
"Detailed neon signs and rainy streets",
"Cybernetic implants and micro-textures"
],
"upscale_factor": 2.0,
"grid_schedule": [2, 3],
"tile_overlap": 0.15
}
→
👁️ Session UI Output
✔ Final Result: 4096 x 4096 px
Base Generation
Depth 0 Map (Red Grid)
Refined Region (2x)
Final Composite
Configuration Parameters
| Field | Type | Description |
|---|---|---|
output_file * |
String | The output file path for the final high-res image. |
prompts * |
List<String> | One prompt per level of detail. First is for the base image. |
input_file |
String | Optional base image to upscale instead of generating one. |
upscale_factor |
Double | Scale per level (Default: 2.0). |
grid_schedule |
List<Int> | Grid spec per level (e.g. [2, 3] for 2x2 then 3x3). |
tile_overlap |
Double | Overlap fraction (0.0-1.0) to prevent seams (Default: 0.15). |
min_region_size |
Int | Min pixels to trigger refinement (Default: 128). |
retarget_subimages |
Boolean | Aligns refined crops to original bounds (Default: true). |
Task Execution Lifecycle
- Initialization: Validates output paths and ensures prompts are provided for each recursion depth.
-
Base Generation: Generates the root image using the first prompt or loads the
input_file. -
Recursive Tiling:
- Divides the image into a grid based on
grid_schedule. - Upscales the image using bicubic interpolation.
- Extracts each tile and refines it using Img2Img with the next prompt in the list.
- Applies a feathering algorithm to tile edges to ensure seamless blending.
- Divides the image into a grid based on
-
Composition: Pastes refined tiles back onto the high-resolution canvas, repeating until
maxDepthis reached.
Kotlin Integration
Add this task to your OrchestrationConfig to enable high-res generation capabilities.
val task = TiledImageGenerationTask(
orchestrationConfig = config,
planTask = TiledImageGenerationConfig(
output_file = "output/ultra_res.png",
prompts = listOf(
"A fantasy landscape",
"Detailed flora and fauna",
"Intricate leaf textures and insects"
),
upscale_factor = 2.0,
grid_schedule = listOf(2, 2)
)
)