DEV Community

KunStudio
KunStudio

Posted on • Originally published at ai-garden-design.pages.dev

Redesigning a Yard Without Touching the House: Structure-Preserving AI Image Edits With FLUX.2 [pro]

Redesigning a Yard Without Touching the House: Structure-Preserving AI Image Edits With FLUX.2 [pro]

AI Garden Design takes a photo of a front yard, backyard, or facade and re-renders the landscaping in a different style — modern, cottage, Japanese zen, desert xeriscape, tropical — while leaving the house itself alone. That constraint, "leave the house alone," turned out to be the whole engineering problem. Nobody wants a "redesign" that also invents a different roofline or moves the driveway.

The model choice: an edit model, not a fresh generation

This isn't text-to-image, it's image-to-image editing — specifically fal-ai/flux-2-pro/edit, a multi-reference, structure-preserving photoreal edit model. The uploaded photo is the reference image, and image_size: "auto" matches the output aspect ratio to the input instead of forcing a fixed size, which matters when the same house has to stay in the same position in the frame:

async function falRedesign(env, imageUrl, prompt) {
  const res = await falQueue(env, "fal-ai/flux-2-pro/edit", {
    prompt, image_urls: [imageUrl],
    image_size: "auto", output_format: "jpeg",
    safety_tolerance: "5",
  });
  const base = res.images && res.images[0] && res.images[0].url;
  if (!base) throw new Error("no image");
  return falUpscale(env, base);
}
Enter fullscreen mode Exit fullscreen mode

safety_tolerance: "5" (the most permissive setting) exists for a boring reason: default safety filters on image-edit models are tuned for far broader content than "photo of a lawn," and even benign yard photos were tripping false positives without it.

Preserving structure is a prompting problem, not a masking problem

The obvious approach would be an inpainting mask — edit only the ground, leave the house region untouched pixel-for-pixel. This pipe doesn't do that; it relies entirely on prompt instructions. Every style prompt follows the same shape: describe the new landscaping, then explicitly state what not to touch:

modern:
  "Redesign only the outdoor yard and landscaping in a clean modern style: geometric " +
  "planting beds, ornamental grasses, minimalist concrete or corten-steel planters, a tidy " +
  "paved path, low-maintenance evergreen shrubs and a crisp lawn edge. Keep the house, walls, " +
  "windows, roof, driveway, fences and property boundaries exactly unchanged." + REAL
Enter fullscreen mode Exit fullscreen mode

REAL is a shared suffix appended to every style prompt — a push toward "real DSLR architectural photograph" plus an explicit reject list: no illustration, no cartoon, no Unreal-Engine-style 3D render, no plastic CGI sheen. Landscape imagery lives or dies on "does this look like a real photo of my actual house," so the negative instructions do as much work as the positive description.

Same finishing-pass trick as the rest of the fal.ai pipes

After the edit model returns a base render, it runs through fal-ai/clarity-upscaler again — low creativity (0.3), moderate resemblance (0.75) — purely for sharpness, with a try/catch that falls back to the un-upscaled base on any failure so a paid render is never lost to a flaky second call:

async function falUpscale(env, imageUrl) {
  try {
    const res = await falQueue(env, "fal-ai/clarity-upscaler", {
      image_url: imageUrl, upscale_factor: 2, creativity: 0.3, resemblance: 0.75,
      num_inference_steps: 18,
      prompt: "masterpiece, best quality, highres, sharp, photorealistic garden photograph",
    }, 60);
    return (res.image && res.image.url) || imageUrl;
  } catch (e) { return imageUrl; }
}
Enter fullscreen mode Exit fullscreen mode

The submit-then-poll helper (falQueue) is fully generic — the same function submits to flux-2-pro/edit, clarity-upscaler, and backs the text add-on below.

The upsell: an LLM-written landscaping brief, gated by the same grant

The Pro tier ($19.99, 25 renders across all five styles) unlocks /api/brief, which calls Claude (claude-haiku-4-5) to write a plant list, a rough budget, and a contractor-ready scope of work. It reuses the same HMAC grant verification as the image endpoint, plus one extra check — the tier itself has to have brief: true:

const tier = TIERS[grant.sku];
if (!tier) return json({ error: "Unknown tier" }, 400);
if (!tier.brief) return json({ error: "Design brief is included with the Pro pack only" }, 403);
Enter fullscreen mode Exit fullscreen mode

Feature-gating between Starter ($9.99, 2 styles) and Pro ($19.99, 5 styles + brief) is just a boolean flag on a shared TIERS config, checked in-line at request time — not a separate SKU-handling code path.

Live: https://ai-garden-design.pages.dev/

Top comments (1)

Collapse
 
topstar_ai profile image
Luis Cruz

I found the approach of using a structure-preserving photoreal edit model, specifically fal-ai/flux-2-pro/edit, to redesign yards without altering the house to be quite fascinating. The use of prompt instructions to preserve the structure, rather than relying on masking, is particularly clever. I appreciate how the safety_tolerance setting is used to prevent false positives, and the addition of the REAL suffix to the style prompts to push towards realistic architectural photographs. Have you considered exploring other applications of this technology, such as redesigning interior spaces or even urban landscapes, and how the prompt engineering might need to be adapted for those use cases?