Turn a rough sketch into a finished illustration, same layout
Turn rough sketches into finished illustrations in Gemini without shifting composition. Separate layout from style and verify positions with an overlay test.
Feeding a rough layout sketch into an AI image generator often results in a completely rearranged scene that ignores the original placement of objects. A prompt with only descriptive phrases does not say how much of the sketch's layout must be kept.
The same principle of locking subject structure across generations is covered in consistent character generation.
[1] Start with the short instruction. One sentence gives no condition about what to keep fixed.
Turn this sketch into a warm finished watercolor illustration.This prompt has no condition about object positions, viewpoint, or forbidding extra objects. No images were generated for this guide, so what it actually renders was not tested. The template below states those conditions.
According to the Google Gemini image prompting guide, models preserve primary subjects during style changes only when fixed structural anchors are explicitly separated from stylistic rendering attributes. Furthermore, the Gemini API image generation guide highlights that maintaining original lighting, perspective, and composition requires explicit anchoring in the prompt text.
[2] Structure the prompt by separating anchor elements from artistic treatments.
The attached image is a layout sketch of {scene or space}. Render this sketch into a finished {target style} illustration while preserving the exact layout. [Preserve from Sketch]- Composition & Perspective: Maintain the {camera angle (e.g. eye-level, straight-on view)} and {frame aspect ratio}.- Object Placement: * {Background zone}: {Background objects and area coverage} * {Foreground zone}: {Foreground surface and boundary} * {Primary subject A}: {Name, location, and anchor reference from sketch} * {Primary subject B}: {Name, location, and anchor reference from sketch}- Do not add unrequested furniture, characters, animals, or props. [Style & Finish to Apply]- Art Style: {Target medium and texture (e.g. soft watercolor, clean line art)}- Lighting & Tone: {Direction of light and palette (e.g. warm afternoon sunlight, pastel wash)}- Line Treatment: Replace rough pencil strokes with clean {line work style} and fill with color.Below is a concrete prompt for a window desk sketch containing a window frame, wooden desk, potted plant on the left, and coffee mug on the right.
The attached image is a rough layout sketch of an indoor scene. Render this sketch into a finished digital watercolor illustration while preserving the exact layout. [Preserve from Sketch]- Composition & Perspective: Maintain the eye-level, straight-on camera angle and 4:3 frame ratio.- Object Placement: * Background: Grid window frame occupying the upper half. * Foreground: Wooden desk surface occupying the bottom third. * Left: Small potted plant on the left side of the desk. * Right: Coffee mug with a handle on the right side of the desk.- Do not add new furniture, characters, animals, or extra items. [Style & Finish to Apply]- Art Style: Soft watercolor illustration with subtle paper texture.- Lighting & Mood: Warm afternoon sunlight streaming through the window, casting gentle shadows to the right.- Lines & Details: Replace rough graphite pencil strokes with clean brown contour lines and soft pastel watercolor washes.[3] Use a checklist for the result image. No images were generated, so these are check items chosen while designing the prompt; whether such errors actually occur was not tested.
| Check item | What to look for in the result | Prompt fix |
|---|---|---|
| Object placement | Is the left plant on the left and the right mug on the right? | Specify Left and Right zones in explicit lines |
| Added objects | Did anything not in the sketch appear in empty space? | Explicitly forbid extra objects |
| Pencil lines | Were rough pencil lines painted as stains or cracks? | State to replace graphite strokes with contour line art |
| Viewpoint | Is the straight-on view unchanged? | Fix camera with eye-level, straight-on view |
[4] Verify layout fidelity using visual overlay and automated script testing. First, normalize the sketch and illustration to identical canvas dimensions, then blend them with 50% opacity to visually confirm contour alignment.
$ magick composite -dissolve 50 illustration.png sketch.png diff_overlay.pngCheck by eye whether the desk line, window frame, and mug silhouette overlap the sketch contours. This guide sets no tolerance; how much shift is acceptable is up to you.
Next, a script that compares two JSON files. One is the layout specification you write from the sketch; the other is the layout you write in the same format after looking at the result image. The script does not read the image or coordinates; it only compares the name and zone strings in the two JSON files. If you write the JSON identically, it passes even when the picture's composition is wrong, so it only checks that you transcribed what you saw by eye.
#!/usr/bin/env python3"""usage: check_composition.py sketch.json result.json"""import sys, json VALID_ZONES = {"top", "bottom", "left", "right", "center", "background", "foreground", "full"} def load_spec(path): with open(path, "r", encoding="utf-8") as f: data = json.load(f) if not isinstance(data, dict) or "objects" not in data: raise ValueError(f"Invalid format in {path}: must be dict with 'objects' list") seen, parsed = set(), {} for item in data["objects"]: name, zone = item.get("name"), item.get("zone") if not name or not zone: raise ValueError(f"Each object must have 'name' and 'zone': {item}") if name in seen: raise ValueError(f"Duplicate object key found: {name}") seen.add(name) if zone not in VALID_ZONES: raise ValueError(f"Invalid zone '{zone}' for object '{name}'") parsed[name] = zone return parsed def main(): if len(sys.argv) < 3: sys.exit(2) sketch_objs = load_spec(sys.argv[1]) result_objs = load_spec(sys.argv[2]) issues, checked = 0, set() for name, expected_zone in sketch_objs.items(): checked.add(name) if name not in result_objs: print(f"MISSING: object '{name}' (expected in '{expected_zone}') not found in result") issues += 1 else: actual_zone = result_objs[name] if actual_zone != expected_zone: print(f"MOVED: object '{name}' expected in '{expected_zone}', found in '{actual_zone}'") issues += 1 else: print(f"OK: object '{name}' correctly placed in '{actual_zone}'") for name, actual_zone in result_objs.items(): if name not in checked: print(f"EXTRA: unexpected object '{name}' appeared in '{actual_zone}'") issues += 1 total = len(sketch_objs) print(f"Summary: {total} sketch objects evaluated, {issues} layout issues found") sys.exit(1 if issues > 0 else 0) if __name__ == "__main__": main()Comparing the baseline specification (sketch_layout.json) with a layout written identically (result_ok.json) passes with exit code 0.
$ python3 check_composition.py sketch_layout.json result_ok.jsonOK: object 'window' correctly placed in 'background'OK: object 'desk' correctly placed in 'bottom'OK: object 'potted_plant' correctly placed in 'left'OK: object 'coffee_mug' correctly placed in 'right'Summary: 4 sketch objects evaluated, 0 layout issues foundThree test inputs (a missing item, a moved item, and an added item) all triggered exit code 1. A duplicate name ends the script with an exception. Below is the output when the coffee mug is missing (this is test validation data, not model hallucination).
$ python3 check_composition.py sketch_layout.json result_bad_missing.jsonOK: object 'window' correctly placed in 'background'OK: object 'desk' correctly placed in 'bottom'OK: object 'potted_plant' correctly placed in 'left'MISSING: object 'coffee_mug' (expected in 'right') not found in resultSummary: 4 sketch objects evaluated, 1 layout issues found[5] Do not use generative AI image models for precision industrial design, architectural blueprints, or mechanical parts requiring exact tolerances. Generative image models come with no guarantee of exact dimensions. For exact dimensional fidelity, use dedicated 3D CAD modeling software and parametric rendering tools.